Re: [PATCH 2/4] input: keyboard/mouse/touchscreen/misc: Use dev_get_drvdata()
From: Fuqian Huang
Date: Tue Jul 02 2019 - 07:47:30 EST
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> æ 2019å7æ2æéä äå5:51åéï
>
> On Tue, Jul 2, 2019 at 11:20 AM Fuqian Huang <huangfq.daxian@xxxxxxxxx> wrote:
> >
> > I am not an expert on this. I just write a coccinelle script to search
> > this kind of misuse and fix it in a naive way.
> > Could you tell me about how to use the proper bus accessors? Then I
> > will fix it up and resend a v2 patch set.
>
> First, don't top post.
> And answering to this, simple drop the patch.
> Proper bus accessors is exactly what it's used in the current code.
But why not use dev_get_drvdata directly.
It simplifies getting the 'driver_data' from 'struct device' directly.
And the platform_device here is not required.
Replace it can remove the unnecessary step back and forth. (dev -> pdev -> dev).
Just like the commit
ed835136ee67 ("mfd: Use dev_get_drvdata() directly")
1948d498dcf6("thermal: intel: int340x: processor_thermal_device:
simplify to get driver data")
and many other similar commits in the Linux git log.