[RFCv2: PATCH 2/2] mtd: mediatek: driver for MTK Smart Device Gen1 NAND
Boris Brezillon
boris.brezillon at free-electrons.com
Wed Mar 23 01:26:15 PDT 2016
On Tue, 22 Mar 2016 20:29:44 -0400
Jorge Ramirez-Ortiz <jorge.ramirez-ortiz at linaro.org> wrote:
> On 03/22/2016 12:58 PM, Boris Brezillon wrote:
> >> +
> >> > +static struct sdg1_ecc_if *sdg1_ecc_get(struct device_node *np)
> >> > +{
> >> > + struct platform_device *pdev;
> >> > + struct sdg1_ecc *ecc;
> >> > +
> >> > + pdev = of_find_device_by_node(np);
> >> > + if (!pdev || !platform_get_drvdata(pdev))
> >> > + return ERR_PTR(-EPROBE_DEFER);
> >> > +
> >> > + get_device(&pdev->dev);
> >> > + ecc = platform_get_drvdata(pdev);
> >> > +
> >> > + clk_prepare_enable(ecc->clk);
> >> > + ecc->dev = &pdev->dev;
> > ecc->dev should be assigned in ->probe().
> >
>
> fyi this was just copied verbatim from
Yep, I noticed the jz4780 driver was doing the same. Maybe you can send
a patch to fix it (in general, dev <-> priv data association is done at
proble time).
>
> static struct jz4780_bch *jz4780_bch_get(struct device_node *np)
> {
> struct platform_device *pdev;
> struct jz4780_bch *bch;
>
> pdev = of_find_device_by_node(np);
> if (!pdev || !platform_get_drvdata(pdev))
> return ERR_PTR(-EPROBE_DEFER);
>
> get_device(&pdev->dev);
>
> bch = platform_get_drvdata(pdev);
> clk_prepare_enable(bch->clk);
>
> bch->dev = &pdev->dev;
> return bch;
> }
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
More information about the Linux-mediatek
mailing list