[RFCv2: PATCH 2/2] mtd: mediatek: driver for MTK Smart Device Gen1 NAND
Jorge Ramirez-Ortiz
jorge.ramirez-ortiz at linaro.org
Tue Mar 22 17:29:44 PDT 2016
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
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;
}
More information about the linux-mtd
mailing list