mfd: Use dev_get_drvdata() directly
Using dev_get_drvdata directly. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
4f8f2bb7ab
commit
ed835136ee
|
@ -80,8 +80,6 @@ struct ssbi {
|
|||
int (*write)(struct ssbi *, u16 addr, const u8 *buf, int len);
|
||||
};
|
||||
|
||||
#define to_ssbi(dev) platform_get_drvdata(to_platform_device(dev))
|
||||
|
||||
static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg)
|
||||
{
|
||||
return readl(ssbi->base + reg);
|
||||
|
@ -243,7 +241,7 @@ err:
|
|||
|
||||
int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len)
|
||||
{
|
||||
struct ssbi *ssbi = to_ssbi(dev);
|
||||
struct ssbi *ssbi = dev_get_drvdata(dev);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
|
@ -257,7 +255,7 @@ EXPORT_SYMBOL_GPL(ssbi_read);
|
|||
|
||||
int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len)
|
||||
{
|
||||
struct ssbi *ssbi = to_ssbi(dev);
|
||||
struct ssbi *ssbi = dev_get_drvdata(dev);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -82,8 +82,7 @@ struct t7l66xb {
|
|||
|
||||
static int t7l66xb_mmc_enable(struct platform_device *mmc)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
|
||||
struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
|
||||
unsigned long flags;
|
||||
u8 dev_ctl;
|
||||
int ret;
|
||||
|
@ -108,8 +107,7 @@ static int t7l66xb_mmc_enable(struct platform_device *mmc)
|
|||
|
||||
static int t7l66xb_mmc_disable(struct platform_device *mmc)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
|
||||
struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
|
||||
unsigned long flags;
|
||||
u8 dev_ctl;
|
||||
|
||||
|
@ -128,16 +126,14 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc)
|
|||
|
||||
static void t7l66xb_mmc_pwr(struct platform_device *mmc, int state)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
|
||||
struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
tmio_core_mmc_pwr(t7l66xb->scr + 0x200, 0, state);
|
||||
}
|
||||
|
||||
static void t7l66xb_mmc_clk_div(struct platform_device *mmc, int state)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
|
||||
struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
tmio_core_mmc_clk_div(t7l66xb->scr + 0x200, 0, state);
|
||||
}
|
||||
|
|
|
@ -80,16 +80,14 @@ static int tc6387xb_resume(struct platform_device *dev)
|
|||
|
||||
static void tc6387xb_mmc_pwr(struct platform_device *mmc, int state)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
|
||||
struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
tmio_core_mmc_pwr(tc6387xb->scr + 0x200, 0, state);
|
||||
}
|
||||
|
||||
static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
|
||||
struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
tmio_core_mmc_clk_div(tc6387xb->scr + 0x200, 0, state);
|
||||
}
|
||||
|
@ -97,8 +95,7 @@ static void tc6387xb_mmc_clk_div(struct platform_device *mmc, int state)
|
|||
|
||||
static int tc6387xb_mmc_enable(struct platform_device *mmc)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
|
||||
struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
clk_prepare_enable(tc6387xb->clk32k);
|
||||
|
||||
|
@ -110,8 +107,7 @@ static int tc6387xb_mmc_enable(struct platform_device *mmc)
|
|||
|
||||
static int tc6387xb_mmc_disable(struct platform_device *mmc)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
|
||||
struct tc6387xb *tc6387xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
clk_disable_unprepare(tc6387xb->clk32k);
|
||||
|
||||
|
|
|
@ -122,14 +122,13 @@ enum {
|
|||
|
||||
static int tc6393xb_nand_enable(struct platform_device *nand)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(nand->dev.parent);
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
struct tc6393xb *tc6393xb = dev_get_drvdata(nand->dev.parent);
|
||||
unsigned long flags;
|
||||
|
||||
raw_spin_lock_irqsave(&tc6393xb->lock, flags);
|
||||
|
||||
/* SMD buffer on */
|
||||
dev_dbg(&dev->dev, "SMD buffer on\n");
|
||||
dev_dbg(nand->dev.parent, "SMD buffer on\n");
|
||||
tmio_iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1));
|
||||
|
||||
raw_spin_unlock_irqrestore(&tc6393xb->lock, flags);
|
||||
|
@ -312,8 +311,7 @@ static int tc6393xb_fb_disable(struct platform_device *dev)
|
|||
|
||||
int tc6393xb_lcd_set_power(struct platform_device *fb, bool on)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(fb->dev.parent);
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
struct tc6393xb *tc6393xb = dev_get_drvdata(fb->dev.parent);
|
||||
u8 fer;
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -334,8 +332,7 @@ EXPORT_SYMBOL(tc6393xb_lcd_set_power);
|
|||
|
||||
int tc6393xb_lcd_mode(struct platform_device *fb,
|
||||
const struct fb_videomode *mode) {
|
||||
struct platform_device *dev = to_platform_device(fb->dev.parent);
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
struct tc6393xb *tc6393xb = dev_get_drvdata(fb->dev.parent);
|
||||
unsigned long flags;
|
||||
|
||||
raw_spin_lock_irqsave(&tc6393xb->lock, flags);
|
||||
|
@ -351,8 +348,7 @@ EXPORT_SYMBOL(tc6393xb_lcd_mode);
|
|||
|
||||
static int tc6393xb_mmc_enable(struct platform_device *mmc)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
tmio_core_mmc_enable(tc6393xb->scr + 0x200, 0,
|
||||
tc6393xb_mmc_resources[0].start & 0xfffe);
|
||||
|
@ -362,8 +358,7 @@ static int tc6393xb_mmc_enable(struct platform_device *mmc)
|
|||
|
||||
static int tc6393xb_mmc_resume(struct platform_device *mmc)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
tmio_core_mmc_resume(tc6393xb->scr + 0x200, 0,
|
||||
tc6393xb_mmc_resources[0].start & 0xfffe);
|
||||
|
@ -373,16 +368,14 @@ static int tc6393xb_mmc_resume(struct platform_device *mmc)
|
|||
|
||||
static void tc6393xb_mmc_pwr(struct platform_device *mmc, int state)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
tmio_core_mmc_pwr(tc6393xb->scr + 0x200, 0, state);
|
||||
}
|
||||
|
||||
static void tc6393xb_mmc_clk_div(struct platform_device *mmc, int state)
|
||||
{
|
||||
struct platform_device *dev = to_platform_device(mmc->dev.parent);
|
||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||
struct tc6393xb *tc6393xb = dev_get_drvdata(mmc->dev.parent);
|
||||
|
||||
tmio_core_mmc_clk_div(tc6393xb->scr + 0x200, 0, state);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue