* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Dmitry Torokhov @ 2013-12-04 16:42 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: stefano.stabellini, ian.campbell, xen-devel, linux-kernel,
boris.ostrovsky, david.vrabel, leosilva, ashley, peterhuewe, mail,
tpmdd, tpmdd, bhelgaas, plagnioj, tomi.valkeinen, tpmdd-devel,
linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <1386105246-14337-1-git-send-email-konrad.wilk@oracle.com>
Hi Konrad,
On Tue, Dec 03, 2013 at 04:14:06PM -0500, Konrad Rzeszutek Wilk wrote:
> The user has the option of disabling the platform driver:
> 00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
>
> which is used to unplug the emulated drivers (IDE, Realtek 8169, etc)
> and allow the PV drivers to take over. If the user wishes
> to disable that they can set:
>
> xen_platform_pci=0
> (in the guest config file)
>
> or
> xen_emul_unplug=never
> (on the Linux command line)
>
> except it does not work properly. The PV drivers still try to
> load and since the Xen platform driver is not run - and it
> has not initialized the grant tables, most of the PV drivers
> stumble upon:
>
> input: Xen Virtual Keyboard as /devices/virtual/input/input5
> input: Xen Virtual Pointer as /devices/virtual/input/input6M
> ------------[ cut here ]------------
> kernel BUG at /home/konrad/ssd/konrad/linux/drivers/xen/grant-table.c:1206!
> invalid opcode: 0000 [#1] SMP
> Modules linked in: xen_kbdfront(+) xenfs xen_privcmd
> CPU: 6 PID: 1389 Comm: modprobe Not tainted 3.13.0-rc1upstream-00021-ga6c892b-dirty #1
> Hardware name: Xen HVM domU, BIOS 4.4-unstable 11/26/2013
> RIP: 0010:[<ffffffff813ddc40>] [<ffffffff813ddc40>] get_free_entries+0x2e0/0x300
> Call Trace:
> [<ffffffff8150d9a3>] ? evdev_connect+0x1e3/0x240
> [<ffffffff813ddd0e>] gnttab_grant_foreign_access+0x2e/0x70
> [<ffffffffa0010081>] xenkbd_connect_backend+0x41/0x290 [xen_kbdfront]
> [<ffffffffa0010a12>] xenkbd_probe+0x2f2/0x324 [xen_kbdfront]
> [<ffffffff813e5757>] xenbus_dev_probe+0x77/0x130
> [<ffffffff813e7217>] xenbus_frontend_dev_probe+0x47/0x50
> [<ffffffff8145e9a9>] driver_probe_device+0x89/0x230
> [<ffffffff8145ebeb>] __driver_attach+0x9b/0xa0
> [<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
> [<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
> [<ffffffff8145cf1c>] bus_for_each_dev+0x8c/0xb0
> [<ffffffff8145e7d9>] driver_attach+0x19/0x20
> [<ffffffff8145e260>] bus_add_driver+0x1a0/0x220
> [<ffffffff8145f1ff>] driver_register+0x5f/0xf0
> [<ffffffff813e55c5>] xenbus_register_driver_common+0x15/0x20
> [<ffffffff813e76b3>] xenbus_register_frontend+0x23/0x40
> [<ffffffffa0015000>] ? 0xffffffffa0014fff
> [<ffffffffa001502b>] xenkbd_init+0x2b/0x1000 [xen_kbdfront]
> [<ffffffff81002049>] do_one_initcall+0x49/0x170
>
> .. snip..
>
> which is hardly nice. This patch fixes this by having each
> PV driver check for:
> - if running in PV, then it is fine to execute (as that is their
> native environment).
> - if running in HVM, check if user wanted 'xen_emul_unplug=never',
> in which case bail out and don't load PV drivers.
> - if running in HVM, and if PCI device 5853:0001 (xen_platform_pci)
> does not exist, then bail out and not load PV drivers.
>
> P.S.
> Ian Campbell suggested getting rid of 'xen_platform_pci_unplug'
> but unfortunatly the xen-blkfront driver is using it, so we
> cannot do it.
>
> Reported-by: Sander Eikelenboom <linux@eikelenboom.it
> Reported-by: Anthony PERARD <anthony.perard@citrix.com>
> Reported-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
For input:
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
...
> +#if defined(CONFIG_XEN_PVHVM)
> +extern bool xen_has_pv_devices(void);
> +#else
> +static inline bool xen_has_pv_devices(void)
> +{
> +#if defined(CONFIG_XEN)
> + return true;
> +#else
> + return false;
> +#endif
return IS_ENABLED(CONFIG_XEN);
?
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Ian Campbell @ 2013-12-04 13:06 UTC (permalink / raw)
To: David Vrabel
Cc: Konrad Rzeszutek Wilk, stefano.stabellini, xen-devel,
linux-kernel, boris.ostrovsky, leosilva, ashley, peterhuewe, mail,
tpmdd, tpmdd, dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen,
tpmdd-devel, linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <529F2758.9070304@citrix.com>
On Wed, 2013-12-04 at 13:00 +0000, David Vrabel wrote:
> On 03/12/13 21:14, Konrad Rzeszutek Wilk wrote:
> >
> > Ian Campbell suggested getting rid of 'xen_platform_pci_unplug'
> > but unfortunatly the xen-blkfront driver is using it, so we
> > cannot do it.
>
> I had a look at what blkfront was using this for and it seems dumb. How
> did we end up with the frontend driver working around toolstack bugs?
> If HVM Linux guest didn't want (e.g.,) PV CDROM, the toolstack shouldn't
> have created one.
Note that this cdrom stuff is actually nothing to do with the unplug
variable -- it just happens to be right next to that check.
Not that the use of the unplug var there doesn't also look pretty odd...
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: David Vrabel @ 2013-12-04 13:00 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: stefano.stabellini, ian.campbell, xen-devel, linux-kernel,
boris.ostrovsky, leosilva, ashley, peterhuewe, mail, tpmdd, tpmdd,
dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen, tpmdd-devel,
linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <1386105246-14337-1-git-send-email-konrad.wilk@oracle.com>
On 03/12/13 21:14, Konrad Rzeszutek Wilk wrote:
>
> Ian Campbell suggested getting rid of 'xen_platform_pci_unplug'
> but unfortunatly the xen-blkfront driver is using it, so we
> cannot do it.
I had a look at what blkfront was using this for and it seems dumb. How
did we end up with the frontend driver working around toolstack bugs?
If HVM Linux guest didn't want (e.g.,) PV CDROM, the toolstack shouldn't
have created one.
And perhaps more importantly, if you actually want a PV CDROM in a HVM
guest, it's not possible.
David
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Ian Campbell @ 2013-12-04 11:23 UTC (permalink / raw)
To: Stefano Stabellini
Cc: Konrad Rzeszutek Wilk, xen-devel, linux-kernel, boris.ostrovsky,
david.vrabel, leosilva, ashley, peterhuewe, mail, tpmdd, tpmdd,
dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen, tpmdd-devel,
linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <alpine.DEB.2.02.1312041116230.7093@kaball.uk.xensource.com>
On Wed, 2013-12-04 at 11:18 +0000, Stefano Stabellini wrote:
> On Wed, 4 Dec 2013, Ian Campbell wrote:
> > On Wed, 2013-12-04 at 11:05 +0000, Stefano Stabellini wrote:
> > > On Wed, 4 Dec 2013, Ian Campbell wrote:
> > > > On Wed, 2013-12-04 at 10:51 +0000, Stefano Stabellini wrote:
> > > > > On Wed, 4 Dec 2013, Ian Campbell wrote:
> > > > > > > +bool xen_has_pv_devices(void)
> > > > > > > +{
> > > > > > > + if (!xen_domain())
> > > > > > > + return false;
> > > > > > > +
> > > > > > > + if (xen_hvm_domain()) {
> > > > > > > + /* User requested no unplug, so no PV drivers. */
> > > > > > > + if (xen_emul_unplug & XEN_UNPLUG_NEVER)
> > > > > > > + return false;
> > > > > >
> > > > > > I think you need
> > > > > > if (xen_emul_unpug & XEN_UNPLUG_UNNECESSARY)
> > > > > > return true;
> > > > > > don't you?
> > > > >
> > > > > XEN_UNPLUG_UNNECESSARY was introduced to enable the platform PCI device
> > > > > even if it didn't respond properly to the unplug protocol.
> > > > > The corresponding parameter is called "unnecessary" because if you pass
> > > > > it to the kernel you mean that it is unnecessary to unplug the emulated
> > > > > devices but you can use the pv devices anyway.
> > > > >
> > > > > So no, we shouldn't check for XEN_UNPLUG_UNNECESSARY here.
> > > >
> > > > Oh, we will eventually fall through to the return true, so it does
> > > > actually work out OK.
> > > >
> > > > I'd still be in favour of handling each option explicitly, for clarity.
> > > > Which means checking for XEN_UNPLUG_UNNECESSARY.
> > >
> > > I think is wrong to check for any xen_emul_unpug options in this function.
> > > The xen_emul_unpug options should be used to set the right value of
> > > xen_platform_pci_unplug. (See my other reply.)
> >
> > Whichever one we check we should still be checking explicitly for the
> > "unnecessary" case, for clarity if nothing else.
>
> Sure, that is OK for me.
> In that case should we check for the full list of possible options?
We probably should. That probably means an extra
xen_has_pv_{disk,nic}_devices() which is the existing one plus the
specific checks?
>
> ide-disks -- unplug primary master IDE devices
> aux-ide-disks -- unplug non-primary-master IDE devices
> nics -- unplug network devices
> all -- unplug all emulated devices (NICs and IDE disks)
> unnecessary -- unplugging emulated devices is
> unnecessary even if the host did not respond to
> the unplug protocol
> never -- do not unplug even if version check succeeds
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Stefano Stabellini @ 2013-12-04 11:18 UTC (permalink / raw)
To: Ian Campbell
Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, xen-devel,
linux-kernel, boris.ostrovsky, david.vrabel, leosilva, ashley,
peterhuewe, mail, tpmdd, tpmdd, dmitry.torokhov, bhelgaas,
plagnioj, tomi.valkeinen, tpmdd-devel, linux-input, netdev,
linux-pci, linux-fbdev
In-Reply-To: <1386155291.17466.19.camel@kazak.uk.xensource.com>
On Wed, 4 Dec 2013, Ian Campbell wrote:
> On Wed, 2013-12-04 at 11:05 +0000, Stefano Stabellini wrote:
> > On Wed, 4 Dec 2013, Ian Campbell wrote:
> > > On Wed, 2013-12-04 at 10:51 +0000, Stefano Stabellini wrote:
> > > > On Wed, 4 Dec 2013, Ian Campbell wrote:
> > > > > > +bool xen_has_pv_devices(void)
> > > > > > +{
> > > > > > + if (!xen_domain())
> > > > > > + return false;
> > > > > > +
> > > > > > + if (xen_hvm_domain()) {
> > > > > > + /* User requested no unplug, so no PV drivers. */
> > > > > > + if (xen_emul_unplug & XEN_UNPLUG_NEVER)
> > > > > > + return false;
> > > > >
> > > > > I think you need
> > > > > if (xen_emul_unpug & XEN_UNPLUG_UNNECESSARY)
> > > > > return true;
> > > > > don't you?
> > > >
> > > > XEN_UNPLUG_UNNECESSARY was introduced to enable the platform PCI device
> > > > even if it didn't respond properly to the unplug protocol.
> > > > The corresponding parameter is called "unnecessary" because if you pass
> > > > it to the kernel you mean that it is unnecessary to unplug the emulated
> > > > devices but you can use the pv devices anyway.
> > > >
> > > > So no, we shouldn't check for XEN_UNPLUG_UNNECESSARY here.
> > >
> > > Oh, we will eventually fall through to the return true, so it does
> > > actually work out OK.
> > >
> > > I'd still be in favour of handling each option explicitly, for clarity.
> > > Which means checking for XEN_UNPLUG_UNNECESSARY.
> >
> > I think is wrong to check for any xen_emul_unpug options in this function.
> > The xen_emul_unpug options should be used to set the right value of
> > xen_platform_pci_unplug. (See my other reply.)
>
> Whichever one we check we should still be checking explicitly for the
> "unnecessary" case, for clarity if nothing else.
Sure, that is OK for me.
In that case should we check for the full list of possible options?
ide-disks -- unplug primary master IDE devices
aux-ide-disks -- unplug non-primary-master IDE devices
nics -- unplug network devices
all -- unplug all emulated devices (NICs and IDE disks)
unnecessary -- unplugging emulated devices is
unnecessary even if the host did not respond to
the unplug protocol
never -- do not unplug even if version check succeeds
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Ian Campbell @ 2013-12-04 11:08 UTC (permalink / raw)
To: Stefano Stabellini
Cc: Konrad Rzeszutek Wilk, xen-devel, linux-kernel, boris.ostrovsky,
david.vrabel, leosilva, ashley, peterhuewe, mail, tpmdd, tpmdd,
dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen, tpmdd-devel,
linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <alpine.DEB.2.02.1312041104110.7093@kaball.uk.xensource.com>
On Wed, 2013-12-04 at 11:05 +0000, Stefano Stabellini wrote:
> On Wed, 4 Dec 2013, Ian Campbell wrote:
> > On Wed, 2013-12-04 at 10:51 +0000, Stefano Stabellini wrote:
> > > On Wed, 4 Dec 2013, Ian Campbell wrote:
> > > > > +bool xen_has_pv_devices(void)
> > > > > +{
> > > > > + if (!xen_domain())
> > > > > + return false;
> > > > > +
> > > > > + if (xen_hvm_domain()) {
> > > > > + /* User requested no unplug, so no PV drivers. */
> > > > > + if (xen_emul_unplug & XEN_UNPLUG_NEVER)
> > > > > + return false;
> > > >
> > > > I think you need
> > > > if (xen_emul_unpug & XEN_UNPLUG_UNNECESSARY)
> > > > return true;
> > > > don't you?
> > >
> > > XEN_UNPLUG_UNNECESSARY was introduced to enable the platform PCI device
> > > even if it didn't respond properly to the unplug protocol.
> > > The corresponding parameter is called "unnecessary" because if you pass
> > > it to the kernel you mean that it is unnecessary to unplug the emulated
> > > devices but you can use the pv devices anyway.
> > >
> > > So no, we shouldn't check for XEN_UNPLUG_UNNECESSARY here.
> >
> > Oh, we will eventually fall through to the return true, so it does
> > actually work out OK.
> >
> > I'd still be in favour of handling each option explicitly, for clarity.
> > Which means checking for XEN_UNPLUG_UNNECESSARY.
>
> I think is wrong to check for any xen_emul_unpug options in this function.
> The xen_emul_unpug options should be used to set the right value of
> xen_platform_pci_unplug. (See my other reply.)
Whichever one we check we should still be checking explicitly for the
"unnecessary" case, for clarity if nothing else.
TBH I think the split between xen_emul_unplug and
xen_platform_pci_unplug is a bit artificial. There should be one value
which is static to platform-pci-unplug.c and accessor functions should
be provided for other code to use. Open coding all those accesses to
xen_platform_pci_unplug in every driver is just too error prone.
Ian.
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Stefano Stabellini @ 2013-12-04 11:05 UTC (permalink / raw)
To: Ian Campbell
Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, xen-devel,
linux-kernel, boris.ostrovsky, david.vrabel, leosilva, ashley,
peterhuewe, mail, tpmdd, tpmdd, dmitry.torokhov, bhelgaas,
plagnioj, tomi.valkeinen, tpmdd-devel, linux-input, netdev,
linux-pci, linux-fbdev
In-Reply-To: <1386154783.17466.14.camel@kazak.uk.xensource.com>
On Wed, 4 Dec 2013, Ian Campbell wrote:
> On Wed, 2013-12-04 at 10:51 +0000, Stefano Stabellini wrote:
> > On Wed, 4 Dec 2013, Ian Campbell wrote:
> > > > +bool xen_has_pv_devices(void)
> > > > +{
> > > > + if (!xen_domain())
> > > > + return false;
> > > > +
> > > > + if (xen_hvm_domain()) {
> > > > + /* User requested no unplug, so no PV drivers. */
> > > > + if (xen_emul_unplug & XEN_UNPLUG_NEVER)
> > > > + return false;
> > >
> > > I think you need
> > > if (xen_emul_unpug & XEN_UNPLUG_UNNECESSARY)
> > > return true;
> > > don't you?
> >
> > XEN_UNPLUG_UNNECESSARY was introduced to enable the platform PCI device
> > even if it didn't respond properly to the unplug protocol.
> > The corresponding parameter is called "unnecessary" because if you pass
> > it to the kernel you mean that it is unnecessary to unplug the emulated
> > devices but you can use the pv devices anyway.
> >
> > So no, we shouldn't check for XEN_UNPLUG_UNNECESSARY here.
>
> Oh, we will eventually fall through to the return true, so it does
> actually work out OK.
>
> I'd still be in favour of handling each option explicitly, for clarity.
> Which means checking for XEN_UNPLUG_UNNECESSARY.
I think is wrong to check for any xen_emul_unpug options in this function.
The xen_emul_unpug options should be used to set the right value of
xen_platform_pci_unplug. (See my other reply.)
> > > > + /* And user has xen_platform_pci=0 set in guest config as
> > > > + * driver did not modify the value. */
> > > > + if (!xen_platform_pci_unplug)
> > > > + return false;
>
> I assume this check doesn't trigger if unnecessary has been specified?
right
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Ian Campbell @ 2013-12-04 10:59 UTC (permalink / raw)
To: Stefano Stabellini
Cc: Konrad Rzeszutek Wilk, xen-devel, linux-kernel, boris.ostrovsky,
david.vrabel, leosilva, ashley, peterhuewe, mail, tpmdd, tpmdd,
dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen, tpmdd-devel,
linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <alpine.DEB.2.02.1312041049310.7093@kaball.uk.xensource.com>
On Wed, 2013-12-04 at 10:51 +0000, Stefano Stabellini wrote:
> On Wed, 4 Dec 2013, Ian Campbell wrote:
> > > +bool xen_has_pv_devices(void)
> > > +{
> > > + if (!xen_domain())
> > > + return false;
> > > +
> > > + if (xen_hvm_domain()) {
> > > + /* User requested no unplug, so no PV drivers. */
> > > + if (xen_emul_unplug & XEN_UNPLUG_NEVER)
> > > + return false;
> >
> > I think you need
> > if (xen_emul_unpug & XEN_UNPLUG_UNNECESSARY)
> > return true;
> > don't you?
>
> XEN_UNPLUG_UNNECESSARY was introduced to enable the platform PCI device
> even if it didn't respond properly to the unplug protocol.
> The corresponding parameter is called "unnecessary" because if you pass
> it to the kernel you mean that it is unnecessary to unplug the emulated
> devices but you can use the pv devices anyway.
>
> So no, we shouldn't check for XEN_UNPLUG_UNNECESSARY here.
Oh, we will eventually fall through to the return true, so it does
actually work out OK.
I'd still be in favour of handling each option explicitly, for clarity.
Which means checking for XEN_UNPLUG_UNNECESSARY.
> > > + /* And user has xen_platform_pci=0 set in guest config as
> > > + * driver did not modify the value. */
> > > + if (!xen_platform_pci_unplug)
> > > + return false;
I assume this check doesn't trigger if unnecessary has been specified?
> > > + }
> > > + return true;
> > > +}
> > > +EXPORT_SYMBOL_GPL(xen_has_pv_devices);
> > > +
> > > void xen_unplug_emulated_devices(void)
> > > {
> > > int r;
> >
> >
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Stefano Stabellini @ 2013-12-04 10:51 UTC (permalink / raw)
To: Ian Campbell
Cc: Konrad Rzeszutek Wilk, stefano.stabellini, xen-devel,
linux-kernel, boris.ostrovsky, david.vrabel, leosilva, ashley,
peterhuewe, mail, tpmdd, tpmdd, dmitry.torokhov, bhelgaas,
plagnioj, tomi.valkeinen, tpmdd-devel, linux-input, netdev,
linux-pci, linux-fbdev
In-Reply-To: <1386149848.13256.86.camel@kazak.uk.xensource.com>
On Wed, 4 Dec 2013, Ian Campbell wrote:
> > +bool xen_has_pv_devices(void)
> > +{
> > + if (!xen_domain())
> > + return false;
> > +
> > + if (xen_hvm_domain()) {
> > + /* User requested no unplug, so no PV drivers. */
> > + if (xen_emul_unplug & XEN_UNPLUG_NEVER)
> > + return false;
>
> I think you need
> if (xen_emul_unpug & XEN_UNPLUG_UNNECESSARY)
> return true;
> don't you?
XEN_UNPLUG_UNNECESSARY was introduced to enable the platform PCI device
even if it didn't respond properly to the unplug protocol.
The corresponding parameter is called "unnecessary" because if you pass
it to the kernel you mean that it is unnecessary to unplug the emulated
devices but you can use the pv devices anyway.
So no, we shouldn't check for XEN_UNPLUG_UNNECESSARY here.
> > + /* And user has xen_platform_pci=0 set in guest config as
> > + * driver did not modify the value. */
> > + if (!xen_platform_pci_unplug)
> > + return false;
> > + }
> > + return true;
> > +}
> > +EXPORT_SYMBOL_GPL(xen_has_pv_devices);
> > +
> > void xen_unplug_emulated_devices(void)
> > {
> > int r;
>
>
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Stefano Stabellini @ 2013-12-04 10:48 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: stefano.stabellini, ian.campbell, xen-devel, linux-kernel,
boris.ostrovsky, david.vrabel, leosilva, ashley, peterhuewe, mail,
tpmdd, tpmdd, dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen,
tpmdd-devel, linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <1386105246-14337-1-git-send-email-konrad.wilk@oracle.com>
On Tue, 3 Dec 2013, Konrad Rzeszutek Wilk wrote:
> diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
> index 0a78524..087dfeb 100644
> --- a/arch/x86/xen/platform-pci-unplug.c
> +++ b/arch/x86/xen/platform-pci-unplug.c
> @@ -69,6 +69,24 @@ static int check_platform_magic(void)
> return 0;
> }
>
> +bool xen_has_pv_devices(void)
> +{
> + if (!xen_domain())
> + return false;
> +
> + if (xen_hvm_domain()) {
> + /* User requested no unplug, so no PV drivers. */
> + if (xen_emul_unplug & XEN_UNPLUG_NEVER)
> + return false;
Considering that if (xen_emul_unplug & XEN_UNPLUG_NEVER) we never set
xen_platform_pci_unplug, this check is redundant.
> + /* And user has xen_platform_pci=0 set in guest config as
> + * driver did not modify the value. */
> + if (!xen_platform_pci_unplug)
> + return false;
> + }
> + return true;
> +}
> +EXPORT_SYMBOL_GPL(xen_has_pv_devices);
> +
> void xen_unplug_emulated_devices(void)
> {
> int r;
^ permalink raw reply
* Re: [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Ian Campbell @ 2013-12-04 9:37 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: stefano.stabellini, xen-devel, linux-kernel, boris.ostrovsky,
david.vrabel, leosilva, ashley, peterhuewe, mail, tpmdd, tpmdd,
dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen, tpmdd-devel,
linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <1386105246-14337-1-git-send-email-konrad.wilk@oracle.com>
On Tue, 2013-12-03 at 16:14 -0500, Konrad Rzeszutek Wilk wrote:
> The user has the option of disabling the platform driver:
> 00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
>
> which is used to unplug the emulated drivers (IDE, Realtek 8169, etc)
> and allow the PV drivers to take over. If the user wishes
> to disable that they can set:
>
> xen_platform_pci=0
> (in the guest config file)
>
> or
> xen_emul_unplug=never
> (on the Linux command line)
>
> except it does not work properly. The PV drivers still try to
> load and since the Xen platform driver is not run - and it
> has not initialized the grant tables, most of the PV drivers
> stumble upon:
>
> input: Xen Virtual Keyboard as /devices/virtual/input/input5
> input: Xen Virtual Pointer as /devices/virtual/input/input6M
> ------------[ cut here ]------------
> kernel BUG at /home/konrad/ssd/konrad/linux/drivers/xen/grant-table.c:1206!
> invalid opcode: 0000 [#1] SMP
> Modules linked in: xen_kbdfront(+) xenfs xen_privcmd
> CPU: 6 PID: 1389 Comm: modprobe Not tainted 3.13.0-rc1upstream-00021-ga6c892b-dirty #1
> Hardware name: Xen HVM domU, BIOS 4.4-unstable 11/26/2013
> RIP: 0010:[<ffffffff813ddc40>] [<ffffffff813ddc40>] get_free_entries+0x2e0/0x300
> Call Trace:
> [<ffffffff8150d9a3>] ? evdev_connect+0x1e3/0x240
> [<ffffffff813ddd0e>] gnttab_grant_foreign_access+0x2e/0x70
> [<ffffffffa0010081>] xenkbd_connect_backend+0x41/0x290 [xen_kbdfront]
> [<ffffffffa0010a12>] xenkbd_probe+0x2f2/0x324 [xen_kbdfront]
> [<ffffffff813e5757>] xenbus_dev_probe+0x77/0x130
> [<ffffffff813e7217>] xenbus_frontend_dev_probe+0x47/0x50
> [<ffffffff8145e9a9>] driver_probe_device+0x89/0x230
> [<ffffffff8145ebeb>] __driver_attach+0x9b/0xa0
> [<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
> [<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
> [<ffffffff8145cf1c>] bus_for_each_dev+0x8c/0xb0
> [<ffffffff8145e7d9>] driver_attach+0x19/0x20
> [<ffffffff8145e260>] bus_add_driver+0x1a0/0x220
> [<ffffffff8145f1ff>] driver_register+0x5f/0xf0
> [<ffffffff813e55c5>] xenbus_register_driver_common+0x15/0x20
> [<ffffffff813e76b3>] xenbus_register_frontend+0x23/0x40
> [<ffffffffa0015000>] ? 0xffffffffa0014fff
> [<ffffffffa001502b>] xenkbd_init+0x2b/0x1000 [xen_kbdfront]
> [<ffffffff81002049>] do_one_initcall+0x49/0x170
>
> .. snip..
>
> which is hardly nice. This patch fixes this by having each
> PV driver check for:
> - if running in PV, then it is fine to execute (as that is their
> native environment).
> - if running in HVM, check if user wanted 'xen_emul_unplug=never',
> in which case bail out and don't load PV drivers.
> - if running in HVM, and if PCI device 5853:0001 (xen_platform_pci)
> does not exist, then bail out and not load PV drivers.
>
> P.S.
> Ian Campbell suggested getting rid of 'xen_platform_pci_unplug'
> but unfortunatly the xen-blkfront driver is using it, so we
> cannot do it.
It might still be nice to expose a suitable semantic interface (i.e.
some relevant predicate) rather than the raw value for blkfront to use.
But that can be a future thing I think.
> Reported-by: Sander Eikelenboom <linux@eikelenboom.it
> Reported-by: Anthony PERARD <anthony.perard@citrix.com>
> Reported-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
> ---
> arch/x86/xen/platform-pci-unplug.c | 18 ++++++++++++++++++
> drivers/block/xen-blkfront.c | 2 +-
> drivers/char/tpm/xen-tpmfront.c | 4 ++++
> drivers/input/misc/xen-kbdfront.c | 4 ++++
> drivers/net/xen-netfront.c | 2 +-
> drivers/pci/xen-pcifront.c | 4 ++++
> drivers/video/xen-fbfront.c | 4 ++++
> drivers/xen/xenbus/xenbus_probe_frontend.c | 2 +-
> include/xen/platform_pci.h | 13 ++++++++++++-
> 9 files changed, 49 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
> index 0a78524..087dfeb 100644
> --- a/arch/x86/xen/platform-pci-unplug.c
> +++ b/arch/x86/xen/platform-pci-unplug.c
> @@ -69,6 +69,24 @@ static int check_platform_magic(void)
> return 0;
> }
>
> +bool xen_has_pv_devices(void)
> +{
> + if (!xen_domain())
> + return false;
> +
> + if (xen_hvm_domain()) {
> + /* User requested no unplug, so no PV drivers. */
> + if (xen_emul_unplug & XEN_UNPLUG_NEVER)
> + return false;
I think you need
if (xen_emul_unpug & XEN_UNPLUG_UNNECESSARY)
return true;
don't you?
> + /* And user has xen_platform_pci=0 set in guest config as
> + * driver did not modify the value. */
> + if (!xen_platform_pci_unplug)
> + return false;
> + }
> + return true;
> +}
> +EXPORT_SYMBOL_GPL(xen_has_pv_devices);
> +
> void xen_unplug_emulated_devices(void)
> {
> int r;
^ permalink raw reply
* Re: [Xen-devel] [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Matthew Daley @ 2013-12-04 0:03 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: Stefano Stabellini, Ian Campbell, xen-devel, linux-kernel,
boris.ostrovsky, david.vrabel, leosilva, ashley, peterhuewe, mail,
tpmdd, tpmdd, dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen,
tpmdd-devel, linux-input, netdev, linux-pci, linux-fbdev
In-Reply-To: <1386105246-14337-1-git-send-email-konrad.wilk@oracle.com>
On Wed, Dec 4, 2013 at 10:14 AM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> The user has the option of disabling the platform driver:
> 00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
>
> which is used to unplug the emulated drivers (IDE, Realtek 8169, etc)
> and allow the PV drivers to take over. If the user wishes
> to disable that they can set:
>
> xen_platform_pci=0
> (in the guest config file)
>
> or
> xen_emul_unplug=never
> (on the Linux command line)
>
> except it does not work properly. The PV drivers still try to
> load and since the Xen platform driver is not run - and it
> has not initialized the grant tables, most of the PV drivers
> stumble upon:
>
> input: Xen Virtual Keyboard as /devices/virtual/input/input5
> input: Xen Virtual Pointer as /devices/virtual/input/input6M
> ------------[ cut here ]------------
> kernel BUG at /home/konrad/ssd/konrad/linux/drivers/xen/grant-table.c:1206!
> invalid opcode: 0000 [#1] SMP
> Modules linked in: xen_kbdfront(+) xenfs xen_privcmd
> CPU: 6 PID: 1389 Comm: modprobe Not tainted 3.13.0-rc1upstream-00021-ga6c892b-dirty #1
> Hardware name: Xen HVM domU, BIOS 4.4-unstable 11/26/2013
> RIP: 0010:[<ffffffff813ddc40>] [<ffffffff813ddc40>] get_free_entries+0x2e0/0x300
> Call Trace:
> [<ffffffff8150d9a3>] ? evdev_connect+0x1e3/0x240
> [<ffffffff813ddd0e>] gnttab_grant_foreign_access+0x2e/0x70
> [<ffffffffa0010081>] xenkbd_connect_backend+0x41/0x290 [xen_kbdfront]
> [<ffffffffa0010a12>] xenkbd_probe+0x2f2/0x324 [xen_kbdfront]
> [<ffffffff813e5757>] xenbus_dev_probe+0x77/0x130
> [<ffffffff813e7217>] xenbus_frontend_dev_probe+0x47/0x50
> [<ffffffff8145e9a9>] driver_probe_device+0x89/0x230
> [<ffffffff8145ebeb>] __driver_attach+0x9b/0xa0
> [<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
> [<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
> [<ffffffff8145cf1c>] bus_for_each_dev+0x8c/0xb0
> [<ffffffff8145e7d9>] driver_attach+0x19/0x20
> [<ffffffff8145e260>] bus_add_driver+0x1a0/0x220
> [<ffffffff8145f1ff>] driver_register+0x5f/0xf0
> [<ffffffff813e55c5>] xenbus_register_driver_common+0x15/0x20
> [<ffffffff813e76b3>] xenbus_register_frontend+0x23/0x40
> [<ffffffffa0015000>] ? 0xffffffffa0014fff
> [<ffffffffa001502b>] xenkbd_init+0x2b/0x1000 [xen_kbdfront]
> [<ffffffff81002049>] do_one_initcall+0x49/0x170
>
> .. snip..
>
> which is hardly nice. This patch fixes this by having each
> PV driver check for:
> - if running in PV, then it is fine to execute (as that is their
> native environment).
> - if running in HVM, check if user wanted 'xen_emul_unplug=never',
> in which case bail out and don't load PV drivers.
> - if running in HVM, and if PCI device 5853:0001 (xen_platform_pci)
> does not exist, then bail out and not load PV drivers.
>
> P.S.
> Ian Campbell suggested getting rid of 'xen_platform_pci_unplug'
> but unfortunatly the xen-blkfront driver is using it, so we
> cannot do it.
>
> Reported-by: Sander Eikelenboom <linux@eikelenboom.it
> Reported-by: Anthony PERARD <anthony.perard@citrix.com>
> Reported-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
I think you forgot your Signed-off-by line.
- Matthew
^ permalink raw reply
* [PATCH] xen/pvhvm: If xen_platform_pci=0 is set don't blow up.
From: Konrad Rzeszutek Wilk @ 2013-12-03 21:14 UTC (permalink / raw)
To: stefano.stabellini, ian.campbell, xen-devel, linux-kernel,
boris.ostrovsky, david.vrabel, leosilva, ashley, peterhuewe, mail,
tpmdd, tpmdd, dmitry.torokhov, bhelgaas, plagnioj, tomi.valkeinen,
tpmdd-devel, linux-input, netdev, linux-pci, linux-fbdev
Cc: Konrad Rzeszutek Wilk
The user has the option of disabling the platform driver:
00:02.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
which is used to unplug the emulated drivers (IDE, Realtek 8169, etc)
and allow the PV drivers to take over. If the user wishes
to disable that they can set:
xen_platform_pci=0
(in the guest config file)
or
xen_emul_unplug=never
(on the Linux command line)
except it does not work properly. The PV drivers still try to
load and since the Xen platform driver is not run - and it
has not initialized the grant tables, most of the PV drivers
stumble upon:
input: Xen Virtual Keyboard as /devices/virtual/input/input5
input: Xen Virtual Pointer as /devices/virtual/input/input6M
------------[ cut here ]------------
kernel BUG at /home/konrad/ssd/konrad/linux/drivers/xen/grant-table.c:1206!
invalid opcode: 0000 [#1] SMP
Modules linked in: xen_kbdfront(+) xenfs xen_privcmd
CPU: 6 PID: 1389 Comm: modprobe Not tainted 3.13.0-rc1upstream-00021-ga6c892b-dirty #1
Hardware name: Xen HVM domU, BIOS 4.4-unstable 11/26/2013
RIP: 0010:[<ffffffff813ddc40>] [<ffffffff813ddc40>] get_free_entries+0x2e0/0x300
Call Trace:
[<ffffffff8150d9a3>] ? evdev_connect+0x1e3/0x240
[<ffffffff813ddd0e>] gnttab_grant_foreign_access+0x2e/0x70
[<ffffffffa0010081>] xenkbd_connect_backend+0x41/0x290 [xen_kbdfront]
[<ffffffffa0010a12>] xenkbd_probe+0x2f2/0x324 [xen_kbdfront]
[<ffffffff813e5757>] xenbus_dev_probe+0x77/0x130
[<ffffffff813e7217>] xenbus_frontend_dev_probe+0x47/0x50
[<ffffffff8145e9a9>] driver_probe_device+0x89/0x230
[<ffffffff8145ebeb>] __driver_attach+0x9b/0xa0
[<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
[<ffffffff8145eb50>] ? driver_probe_device+0x230/0x230
[<ffffffff8145cf1c>] bus_for_each_dev+0x8c/0xb0
[<ffffffff8145e7d9>] driver_attach+0x19/0x20
[<ffffffff8145e260>] bus_add_driver+0x1a0/0x220
[<ffffffff8145f1ff>] driver_register+0x5f/0xf0
[<ffffffff813e55c5>] xenbus_register_driver_common+0x15/0x20
[<ffffffff813e76b3>] xenbus_register_frontend+0x23/0x40
[<ffffffffa0015000>] ? 0xffffffffa0014fff
[<ffffffffa001502b>] xenkbd_init+0x2b/0x1000 [xen_kbdfront]
[<ffffffff81002049>] do_one_initcall+0x49/0x170
.. snip..
which is hardly nice. This patch fixes this by having each
PV driver check for:
- if running in PV, then it is fine to execute (as that is their
native environment).
- if running in HVM, check if user wanted 'xen_emul_unplug=never',
in which case bail out and don't load PV drivers.
- if running in HVM, and if PCI device 5853:0001 (xen_platform_pci)
does not exist, then bail out and not load PV drivers.
P.S.
Ian Campbell suggested getting rid of 'xen_platform_pci_unplug'
but unfortunatly the xen-blkfront driver is using it, so we
cannot do it.
Reported-by: Sander Eikelenboom <linux@eikelenboom.it
Reported-by: Anthony PERARD <anthony.perard@citrix.com>
Reported-by: Fabio Fantoni <fabio.fantoni@m2r.biz>
---
arch/x86/xen/platform-pci-unplug.c | 18 ++++++++++++++++++
drivers/block/xen-blkfront.c | 2 +-
drivers/char/tpm/xen-tpmfront.c | 4 ++++
drivers/input/misc/xen-kbdfront.c | 4 ++++
drivers/net/xen-netfront.c | 2 +-
drivers/pci/xen-pcifront.c | 4 ++++
drivers/video/xen-fbfront.c | 4 ++++
drivers/xen/xenbus/xenbus_probe_frontend.c | 2 +-
include/xen/platform_pci.h | 13 ++++++++++++-
9 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
index 0a78524..087dfeb 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -69,6 +69,24 @@ static int check_platform_magic(void)
return 0;
}
+bool xen_has_pv_devices(void)
+{
+ if (!xen_domain())
+ return false;
+
+ if (xen_hvm_domain()) {
+ /* User requested no unplug, so no PV drivers. */
+ if (xen_emul_unplug & XEN_UNPLUG_NEVER)
+ return false;
+ /* And user has xen_platform_pci=0 set in guest config as
+ * driver did not modify the value. */
+ if (!xen_platform_pci_unplug)
+ return false;
+ }
+ return true;
+}
+EXPORT_SYMBOL_GPL(xen_has_pv_devices);
+
void xen_unplug_emulated_devices(void)
{
int r;
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 432db1b..9616b81 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2074,7 +2074,7 @@ static int __init xlblk_init(void)
if (!xen_domain())
return -ENODEV;
- if (xen_hvm_domain() && !xen_platform_pci_unplug)
+ if (!xen_has_pv_devices())
return -ENODEV;
if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index c8ff4df..62e7d38 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -17,6 +17,7 @@
#include <xen/xenbus.h>
#include <xen/page.h>
#include "tpm.h"
+#include <xen/platform_pci.h>
struct tpm_private {
struct tpm_chip *chip;
@@ -421,6 +422,9 @@ static int __init xen_tpmfront_init(void)
if (!xen_domain())
return -ENODEV;
+ if (!xen_has_pv_devices())
+ return -ENODEV;
+
return xenbus_register_frontend(&tpmfront_driver);
}
module_init(xen_tpmfront_init);
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index e21c181..fbfdc10 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -29,6 +29,7 @@
#include <xen/interface/io/fbif.h>
#include <xen/interface/io/kbdif.h>
#include <xen/xenbus.h>
+#include <xen/platform_pci.h>
struct xenkbd_info {
struct input_dev *kbd;
@@ -380,6 +381,9 @@ static int __init xenkbd_init(void)
if (xen_initial_domain())
return -ENODEV;
+ if (!xen_has_pv_devices())
+ return -ENODEV;
+
return xenbus_register_frontend(&xenkbd_driver);
}
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index e59acb1..d4b52e9 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -2115,7 +2115,7 @@ static int __init netif_init(void)
if (!xen_domain())
return -ENODEV;
- if (xen_hvm_domain() && !xen_platform_pci_unplug)
+ if (!xen_has_pv_devices())
return -ENODEV;
pr_info("Initialising Xen virtual ethernet driver\n");
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index f7197a7..eae7cd9 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -20,6 +20,7 @@
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <linux/time.h>
+#include <xen/platform_pci.h>
#include <asm/xen/swiotlb-xen.h>
#define INVALID_GRANT_REF (0)
@@ -1138,6 +1139,9 @@ static int __init pcifront_init(void)
if (!xen_pv_domain() || xen_initial_domain())
return -ENODEV;
+ if (!xen_has_pv_devices())
+ return -ENODEV;
+
pci_frontend_registrar(1 /* enable */);
return xenbus_register_frontend(&xenpci_driver);
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index cd005c2..4b2d3ab 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -35,6 +35,7 @@
#include <xen/interface/io/fbif.h>
#include <xen/interface/io/protocols.h>
#include <xen/xenbus.h>
+#include <xen/platform_pci.h>
struct xenfb_info {
unsigned char *fb;
@@ -699,6 +700,9 @@ static int __init xenfb_init(void)
if (xen_initial_domain())
return -ENODEV;
+ if (!xen_has_pv_devices())
+ return -ENODEV;
+
return xenbus_register_frontend(&xenfb_driver);
}
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index 129bf84..cb385c1 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -496,7 +496,7 @@ subsys_initcall(xenbus_probe_frontend_init);
#ifndef MODULE
static int __init boot_wait_for_devices(void)
{
- if (xen_hvm_domain() && !xen_platform_pci_unplug)
+ if (!xen_has_pv_devices())
return -ENODEV;
ready_to_wait_for_devices = 1;
diff --git a/include/xen/platform_pci.h b/include/xen/platform_pci.h
index 438c256..87bc59c 100644
--- a/include/xen/platform_pci.h
+++ b/include/xen/platform_pci.h
@@ -47,5 +47,16 @@ static inline int xen_must_unplug_disks(void) {
}
extern int xen_platform_pci_unplug;
-
+#if defined(CONFIG_XEN_PVHVM)
+extern bool xen_has_pv_devices(void);
+#else
+static inline bool xen_has_pv_devices(void)
+{
+#if defined(CONFIG_XEN)
+ return true;
+#else
+ return false;
+#endif
+}
+#endif
#endif /* _XEN_PLATFORM_PCI_H */
--
1.8.3.1
^ permalink raw reply related
* [PATCH v4] Input: wacom - add SW_MUTE_DEVICE to include/uapi/linux/input.h
From: Ping Cheng @ 2013-12-03 19:59 UTC (permalink / raw)
To: linux-input
Cc: dmitry.torokhov, killertofu, chris, peter.hutterer, Ping Cheng
New Intuos series models added a hardware switch to turn touch
data on/off. The state of the switch is reported periodically
from the tablet. To report the state, SW_MUTE_DEVICE is added
in include/uapi/linux/input.h.
Reviewed_by: Chris Bagwell <chris@cnpbagwell.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Ping Cheng <pingc@wacom.com>
---
v4: Changed SW_TOUCH to SW_MUTE_DEVICE as suggested by Dmitry.
---
drivers/input/tablet/wacom_sys.c | 12 ++++++++++++
drivers/input/tablet/wacom_wac.c | 30 +++++++++++++++++++++++++++---
drivers/input/tablet/wacom_wac.h | 5 +++++
include/uapi/linux/input.h | 1 +
4 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 3a7d99c..bb72fa3 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -1193,6 +1193,8 @@ static void wacom_wireless_work(struct work_struct *work)
wacom_wac1->features.device_type = BTN_TOOL_PEN;
snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
wacom_wac1->features.name);
+ wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
+ wacom_wac1->shared->type = wacom_wac1->features.type;
error = wacom_register_input(wacom1);
if (error)
goto fail;
@@ -1214,6 +1216,10 @@ static void wacom_wireless_work(struct work_struct *work)
error = wacom_register_input(wacom2);
if (error)
goto fail;
+
+ if (wacom_wac1->features.type == INTUOSHT &&
+ wacom_wac1->features.touch_max)
+ wacom_wac->shared->touch_input = wacom_wac2->input;
}
error = wacom_initialize_battery(wacom);
@@ -1392,6 +1398,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
goto fail5;
}
}
+
+ if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) {
+ if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
+ wacom_wac->shared->touch_input = wacom_wac->input;
+ }
+
return 0;
fail5: wacom_destroy_leds(wacom);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index eb60a28..4892366 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1219,13 +1219,23 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
static int wacom_bpt_pen(struct wacom_wac *wacom)
{
+ struct wacom_features *features = &wacom->features;
struct input_dev *input = wacom->input;
unsigned char *data = wacom->data;
int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
- if (data[0] != WACOM_REPORT_PENABLED)
+ if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB)
return 0;
+ if (data[0] == WACOM_REPORT_USB) {
+ if ((features->type == INTUOSHT) && features->touch_max) {
+ input_report_switch(wacom->shared->touch_input,
+ SW_MUTE_DEVICE, data[8] & 0x40);
+ input_sync(wacom->shared->touch_input);
+ }
+ return 0;
+ }
+
prox = (data[1] & 0x20) == 0x20;
/*
@@ -1258,8 +1268,8 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
* touching and applying pressure; do not report negative
* distance.
*/
- if (data[8] <= wacom->features.distance_max)
- d = wacom->features.distance_max - data[8];
+ if (data[8] <= features->distance_max)
+ d = features->distance_max - data[8];
pen = data[1] & 0x01;
btn1 = data[1] & 0x02;
@@ -1310,6 +1320,13 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
if (connected) {
int pid, battery;
+ if ((wacom->shared->type == INTUOSHT) &&
+ wacom->shared->touch_max) {
+ input_report_switch(wacom->shared->touch_input,
+ SW_MUTE_DEVICE, data[5] & 0x40);
+ input_sync(wacom->shared->touch_input);
+ }
+
pid = get_unaligned_be16(&data[6]);
battery = data[5] & 0x3f;
if (wacom->pid != pid) {
@@ -1779,6 +1796,13 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
break;
case INTUOSHT:
+ if (features->touch_max &&
+ (features->device_type == BTN_TOOL_FINGER)) {
+ input_dev->evbit[0] |= BIT_MASK(EV_SW);
+ __set_bit(SW_MUTE_DEVICE, input_dev->swbit);
+ }
+ /* fall through */
+
case BAMBOO_PT:
__clear_bit(ABS_MISC, input_dev->absbit);
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 854cceb..3600cf7 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -55,6 +55,7 @@
#define WACOM_REPORT_TPC1FGE 18
#define WACOM_REPORT_24HDT 1
#define WACOM_REPORT_WL 128
+#define WACOM_REPORT_USB 192
/* device quirks */
#define WACOM_QUIRK_MULTI_INPUT 0x0001
@@ -131,6 +132,10 @@ struct wacom_features {
struct wacom_shared {
bool stylus_in_proximity;
bool touch_down;
+ /* for wireless device to access USB interfaces */
+ unsigned touch_max;
+ int type;
+ struct input_dev *touch_input;
};
struct wacom_wac {
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index a372627..c1f07c9 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -856,6 +856,7 @@ struct input_keymap_entry {
#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
+#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_MAX 0x0f
#define SW_CNT (SW_MAX+1)
--
1.8.3.2
^ permalink raw reply related
* [PATCH] drivers/input/mouse: add support for newer elantech touchpads (released ca. August 2013);
From: Matt Walker @ 2013-12-03 17:42 UTC (permalink / raw)
To: Hauke Mehrtens
Cc: backports-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1992 bytes --]
From: Matt Walker <matt.g.d.walker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Added detection for newer Elantech touchpads, so that kernel doesn't
fall-back to default PS/2 driver. Supports touchpads released after
~August 2013. Fixes bug:
https://lists.launchpad.net/kernel-packages/msg18481.html
Tested-by: Matt Walker <matt.g.d.walker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> on an Acer Aspire S7-392-6302
----
Thanks to Hauke for the reference on how to submit a patch properly.
Please let me know if additional modifications are required.
Diff Output:
--- linux-3.13-rc1/drivers/input/mouse/elantech.c.orig 2013-12-03
12:14:52.829173656 -0500
+++ linux-3.13-rc1/drivers/input/mouse/elantech.c 2013-12-03
12:15:11.833173880 -0500
@@ -1313,6 +1313,7 @@ static int elantech_set_properties(struc
break;
case 6:
case 7:
+ case 8:
etd->hw_version = 4;
break;
default:
On Fri, Nov 29, 2013 at 4:26 PM, Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org> wrote:
> On 11/29/2013 01:00 AM, Matt Walker wrote:
>> Hello,
>>
>> Attached is a patch for drivers/input/mouse/elantech.c. It allows
>> recent Elantech touchpads to be detected. I have tested it on the
>> touchpad that comes with the Acer Aspire S7-392 (released ~August
>> 2013)
>>
>> I figure it could be backported with little effort and no danger,
>> since all it does it add one to the number of values that were
>> previously recognized as valid "firmware version numbers".
>>
>> Begin Patch:
>> 1315a1316
>>> case 8:
>> End Patch
>>
>> Best,
>> Matt
>>
> This is not a patch, I do not know what you want to do.
>
> This is the documentation for hacking on backprts:
> https://backports.wiki.kernel.org/index.php/Documentation/backports/hacking
>
> This is the guideline for patch submission to the linux kernel which
> mostly also applies for backports:
> https://www.kernel.org/doc/Documentation/SubmittingPatches
>
> Hauke
[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 332 bytes --]
--- linux-3.13-rc1/drivers/input/mouse/elantech.c.orig 2013-12-03 12:14:52.829173656 -0500
+++ linux-3.13-rc1/drivers/input/mouse/elantech.c 2013-12-03 12:15:11.833173880 -0500
@@ -1313,6 +1313,7 @@ static int elantech_set_properties(struc
break;
case 6:
case 7:
+ case 8:
etd->hw_version = 4;
break;
default:
^ permalink raw reply
* Re: [PATCH] HID: logitech-dj: add HIDRAW dependency in Kconfig
From: Nestor Lopez Casado @ 2013-12-03 14:03 UTC (permalink / raw)
To: Jiri Kosina
Cc: Olivier Gay, open list:HID CORE LAYER,
linux-kernel@vger.kernel.org, Mathieu Meisser
In-Reply-To: <CAE7qMrq6YzvprAGDTO8uEU9WZXXGpP=TG_OxB6=-1KuF1Tr8sg@mail.gmail.com>
Sorry, no html now.
On Tue, Dec 3, 2013 at 3:01 PM, Nestor Lopez Casado
<nlopezcasad@logitech.com> wrote:
>
>
>
>
> On Tue, Dec 3, 2013 at 1:51 PM, Jiri Kosina <jkosina@suse.cz> wrote:
>>
>> On Tue, 3 Dec 2013, Olivier Gay wrote:
>>
>> > Without hidraw driver, we get this:
>> >
>> > <3>[ 210.131988] logitech-djreceiver 0003:046D:C52B.0005: claimed by
>> > neither input, hiddev nor hidraw
>> > <3>[ 210.132202] logitech-djreceiver 0003:046D:C52B.0005:
>> > logi_dj_probe:hid_hw_start returned error
>> >
>> > In logi_dj_probe, we call hid_hw_start with HID_CONNECT_DEFAULT
>> > argument and if hidraw driver is not present, the call fails and we
>> > return an error in logi_dj_probe.
>> >
>> > > It's clear that without hidraw it's not possible to change the pairing
>> > > from userspace, but I fail to see why probing the receiver should be
>> > > affected?
>> >
>> > As of today, hid-logitech-dj.c depends on hidraw API to work. All HID
>> > reports sent to control / configure the receiver are sent using hidraw
>> > API. That's why we fail logi_dj_probe if we cannot connect to hidraw.
>>
>> Hmm, so unifying receiver is not claimed by hid-input at all?
>> (HID_CONNECT_DEFAULT also contains HID_CONNECT_HIDINPUT) How so?
>>
>> (again, I will not be able to test it with my receiver up until the day
>> after tomorrow).
>
> The unifying receiver has 3 usb interfaces. When hid-logitech-dj driver is loaded, interfaces 0 and 1 are discarded.
>
> Interface 2 consists of a hid class interface with 3 collections, each of which sports the 'vendor' usage, thus, there is no reason for hid_input to claim any of them. On the other hand, hidraw has no issue in claiming the collections, even if they are 'vendor'. As of today, hid-logitech-dj uses hidraw api to send configuration/control reports to interface 2 of the Unifying receiver.
>
> Without the hid-logitech-dj driver, interfaces 0 and 1 are claimed by hid-input, as they correspond to a keyboard and a mouse. But that is not relevant to the discussion.
>>
>>
>> Thanks,
>>
>> --
>> Jiri Kosina
>> SUSE Labs
>
> Cheers,
> -nestor
>
^ permalink raw reply
* Re: [PATCH] HID: logitech-dj: add HIDRAW dependency in Kconfig
From: Jiri Kosina @ 2013-12-03 14:08 UTC (permalink / raw)
To: Nestor Lopez Casado
Cc: Olivier Gay, open list:HID CORE LAYER,
linux-kernel@vger.kernel.org, Mathieu Meisser
In-Reply-To: <CAE7qMrq6YzvprAGDTO8uEU9WZXXGpP=TG_OxB6=-1KuF1Tr8sg@mail.gmail.com>
On Tue, 3 Dec 2013, Nestor Lopez Casado wrote:
> > > <3>[ 210.131988] logitech-djreceiver 0003:046D:C52B.0005: claimed by
> > > neither input, hiddev nor hidraw
> > > <3>[ 210.132202] logitech-djreceiver 0003:046D:C52B.0005:
> > > logi_dj_probe:hid_hw_start returned error
> > >
> > > In logi_dj_probe, we call hid_hw_start with HID_CONNECT_DEFAULT
> > > argument and if hidraw driver is not present, the call fails and we
> > > return an error in logi_dj_probe.
> > >
> > > > It's clear that without hidraw it's not possible to change the pairing
> > > > from userspace, but I fail to see why probing the receiver should be
> > > > affected?
> > >
> > > As of today, hid-logitech-dj.c depends on hidraw API to work. All HID
> > > reports sent to control / configure the receiver are sent using hidraw
> > > API. That's why we fail logi_dj_probe if we cannot connect to hidraw.
> >
> > Hmm, so unifying receiver is not claimed by hid-input at all?
> > (HID_CONNECT_DEFAULT also contains HID_CONNECT_HIDINPUT) How so?
> >
> > (again, I will not be able to test it with my receiver up until the day
> > after tomorrow).
> >
> The unifying receiver has 3 usb interfaces. When hid-logitech-dj driver is
> loaded, interfaces 0 and 1 are discarded.
>
> Interface 2 consists of a hid class interface with 3 collections, each of
> which sports the 'vendor' usage, thus, there is no reason for hid_input to
> claim any of them. On the other hand, hidraw has no issue in claiming the
> collections, even if they are 'vendor'. As of today, hid-logitech-dj uses
> hidraw api to send configuration/control reports to interface 2 of the
> Unifying receiver.
>
> Without the hid-logitech-dj driver, interfaces 0 and 1 are claimed by
> hid-input, as they correspond to a keyboard and a mouse. But that is not
> relevant to the discussion.
Ah, indeed, that's the part I forgot and will find out only when I have my
receiver handy again.
Thanks for the explanation, now it all makes sense. I will be queuing the
patch, with probably slightly more verbose changelog.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH] HID: logitech-dj: add HIDRAW dependency in Kconfig
From: Jiri Kosina @ 2013-12-03 12:51 UTC (permalink / raw)
To: Olivier Gay
Cc: linux-input, linux-kernel, Nestor Lopez Casado, Mathieu Meisser
In-Reply-To: <CAFLMSp-7X568ZdZ-JAAX9ttmMFhYP+DeLuc_-yCw1WCuvVAHng@mail.gmail.com>
On Tue, 3 Dec 2013, Olivier Gay wrote:
> Without hidraw driver, we get this:
>
> <3>[ 210.131988] logitech-djreceiver 0003:046D:C52B.0005: claimed by
> neither input, hiddev nor hidraw
> <3>[ 210.132202] logitech-djreceiver 0003:046D:C52B.0005:
> logi_dj_probe:hid_hw_start returned error
>
> In logi_dj_probe, we call hid_hw_start with HID_CONNECT_DEFAULT
> argument and if hidraw driver is not present, the call fails and we
> return an error in logi_dj_probe.
>
> > It's clear that without hidraw it's not possible to change the pairing
> > from userspace, but I fail to see why probing the receiver should be
> > affected?
>
> As of today, hid-logitech-dj.c depends on hidraw API to work. All HID
> reports sent to control / configure the receiver are sent using hidraw
> API. That's why we fail logi_dj_probe if we cannot connect to hidraw.
Hmm, so unifying receiver is not claimed by hid-input at all?
(HID_CONNECT_DEFAULT also contains HID_CONNECT_HIDINPUT) How so?
(again, I will not be able to test it with my receiver up until the day
after tomorrow).
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH] HID: logitech-dj: add HIDRAW dependency in Kconfig
From: Olivier Gay @ 2013-12-03 10:30 UTC (permalink / raw)
To: Jiri Kosina
Cc: linux-input, linux-kernel, Nestor Lopez Casado, Mathieu Meisser
In-Reply-To: <alpine.LNX.2.00.1312030852410.24931@pobox.suse.cz>
>On Tue, Dec 3, 2013 at 8:53 AM, Jiri Kosina <jkosina@suse.cz> wrote:
> I don't have my receiver with me at the moment, so can't really verify --
> how exactly does it fail during probe()?
Hi Jiri,
Without hidraw driver, we get this:
<3>[ 210.131988] logitech-djreceiver 0003:046D:C52B.0005: claimed by
neither input, hiddev nor hidraw
<3>[ 210.132202] logitech-djreceiver 0003:046D:C52B.0005:
logi_dj_probe:hid_hw_start returned error
In logi_dj_probe, we call hid_hw_start with HID_CONNECT_DEFAULT
argument and if hidraw driver is not present, the call fails and we
return an error in logi_dj_probe.
> It's clear that without hidraw it's not possible to change the pairing
> from userspace, but I fail to see why probing the receiver should be
> affected?
As of today, hid-logitech-dj.c depends on hidraw API to work. All HID
reports sent to control / configure the receiver are sent using hidraw
API. That's why we fail logi_dj_probe if we cannot connect to hidraw.
Best regards,
Olivier
^ permalink raw reply
* Re: [PATCH] HID: logitech-dj: add HIDRAW dependency in Kconfig
From: Jiri Kosina @ 2013-12-03 7:53 UTC (permalink / raw)
To: Olivier Gay
Cc: linux-input, linux-kernel, Nestor Lopez Casado, Mathieu Meisser
In-Reply-To: <1386026244-21553-1-git-send-email-ogay@logitech.com>
On Tue, 3 Dec 2013, Olivier Gay wrote:
> hid-logitech-dj.c driver needs hidraw to work correctly. Without
> hidraw, hid-logitech-dj.c fails during probe() and Logitech
> Unifying devices HID reports aren't recognized.
>
> Signed-off-by: Olivier Gay <ogay@logitech.com>
> Signed-off-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
> Signed-off-by: Mathieu Meisser <mmeisser@logitech.com>
> ---
>
> Hi everyone,
>
> this adds a HIDRAW dependency in Kconfig for hid-logitech-dj.c
> driver. The driver uses hidraw and needs it to work correctly.
>
> Without hidraw if a Logitech Unifying device is plugged, the driver
> fails during probe() and Logitech Unifying devices HID reports aren't
> recognized. This has been the cause of some confusion. Some Linux and
> Android distributions had HID_LOGITECH_DJ enabled without HIDRAW and
> the Unifying mice and keyboards would simply not work (no cursor
Hi Oliver,
I don't have my receiver with me at the moment, so can't really verify --
how exactly does it fail during probe()?
It's clear that without hidraw it's not possible to change the pairing
from userspace, but I fail to see why probing the receiver should be
affected?
Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* [PATCH] Input: use dev_get_platdata()
From: Jingoo Han @ 2013-12-03 6:40 UTC (permalink / raw)
To: 'Dmitry Torokhov'
Cc: 'Dmitry Torokhov', linux-input, 'Jingoo Han',
'Fugang Duan', 'Michael Hennerich',
'Wan ZongShun', 'Josh Wu', 'Ferruh Yigit'
Use the wrapper function for retrieving the platform data instead
of accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Fugang Duan <B38611@freescale.com>
---
drivers/input/keyboard/adp5520-keys.c | 2 +-
drivers/input/keyboard/adp5588-keys.c | 10 ++++++----
drivers/input/keyboard/adp5589-keys.c | 8 ++++----
drivers/input/keyboard/bf54x-keys.c | 4 ++--
drivers/input/keyboard/davinci_keyscan.c | 2 +-
drivers/input/keyboard/ep93xx_keypad.c | 2 +-
drivers/input/keyboard/imx_keypad.c | 3 ++-
drivers/input/keyboard/lm8323.c | 2 +-
drivers/input/keyboard/lm8333.c | 3 ++-
drivers/input/keyboard/max7359_keypad.c | 3 ++-
drivers/input/keyboard/mcs_touchkey.c | 2 +-
drivers/input/keyboard/mpr121_touchkey.c | 3 ++-
drivers/input/keyboard/nomadik-ske-keypad.c | 3 ++-
drivers/input/keyboard/omap-keypad.c | 2 +-
drivers/input/keyboard/pxa930_rotary.c | 3 ++-
drivers/input/keyboard/samsung-keypad.c | 2 +-
drivers/input/keyboard/sh_keysc.c | 4 ++--
drivers/input/keyboard/tca6416-keypad.c | 2 +-
drivers/input/keyboard/tnetv107x-keypad.c | 2 +-
drivers/input/keyboard/twl4030_keypad.c | 2 +-
drivers/input/keyboard/w90p910_keypad.c | 2 +-
drivers/input/leds.c | 2 +-
drivers/input/misc/ad714x.c | 4 ++--
drivers/input/misc/adxl34x.c | 2 +-
drivers/input/misc/bfin_rotary.c | 2 +-
drivers/input/misc/bma150.c | 3 ++-
drivers/input/misc/cma3000_d0x.c | 2 +-
drivers/input/misc/gp2ap002a00f.c | 2 +-
drivers/input/misc/gpio_tilt_polled.c | 3 ++-
drivers/input/misc/kxtj9.c | 3 ++-
drivers/input/misc/pwm-beeper.c | 2 +-
drivers/input/misc/twl4030-vibra.c | 2 +-
drivers/input/mouse/gpio_mouse.c | 2 +-
drivers/input/mouse/pxa930_trkball.c | 2 +-
drivers/input/touchscreen/88pm860x-ts.c | 2 +-
drivers/input/touchscreen/ad7877.c | 2 +-
drivers/input/touchscreen/ad7879.c | 4 ++--
drivers/input/touchscreen/atmel_mxt_ts.c | 2 +-
drivers/input/touchscreen/atmel_tsadcc.c | 2 +-
drivers/input/touchscreen/cy8ctmg110_ts.c | 2 +-
drivers/input/touchscreen/cyttsp_core.c | 4 ++--
drivers/input/touchscreen/da9034-ts.c | 2 +-
drivers/input/touchscreen/edt-ft5x06.c | 2 +-
drivers/input/touchscreen/eeti_ts.c | 2 +-
drivers/input/touchscreen/ili210x.c | 2 +-
drivers/input/touchscreen/mcs5000_ts.c | 4 ++--
drivers/input/touchscreen/pixcir_i2c_ts.c | 3 ++-
drivers/input/touchscreen/s3c2410_ts.c | 4 ++--
drivers/input/touchscreen/st1232.c | 2 +-
drivers/input/touchscreen/tsc2005.c | 2 +-
drivers/input/touchscreen/ucb1400_ts.c | 8 ++++----
drivers/input/touchscreen/wm97xx-core.c | 2 +-
52 files changed, 80 insertions(+), 68 deletions(-)
diff --git a/drivers/input/keyboard/adp5520-keys.c b/drivers/input/keyboard/adp5520-keys.c
index ef26b17..0dc1151 100644
--- a/drivers/input/keyboard/adp5520-keys.c
+++ b/drivers/input/keyboard/adp5520-keys.c
@@ -71,7 +71,7 @@ static int adp5520_keys_notifier(struct notifier_block *nb,
static int adp5520_keys_probe(struct platform_device *pdev)
{
- struct adp5520_keys_platform_data *pdata = pdev->dev.platform_data;
+ struct adp5520_keys_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct input_dev *input;
struct adp5520_keys *dev;
int ret, i;
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 3ed2351..a8f5f92 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -173,7 +173,7 @@ static int adp5588_build_gpiomap(struct adp5588_kpad *kpad,
static int adp5588_gpio_add(struct adp5588_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
- const struct adp5588_kpad_platform_data *pdata = dev->platform_data;
+ const struct adp5588_kpad_platform_data *pdata = dev_get_platdata(dev);
const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
int i, error;
@@ -227,7 +227,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
static void adp5588_gpio_remove(struct adp5588_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
- const struct adp5588_kpad_platform_data *pdata = dev->platform_data;
+ const struct adp5588_kpad_platform_data *pdata = dev_get_platdata(dev);
const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
int error;
@@ -321,7 +321,8 @@ static irqreturn_t adp5588_irq(int irq, void *handle)
static int adp5588_setup(struct i2c_client *client)
{
- const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
+ const struct adp5588_kpad_platform_data *pdata =
+ dev_get_platdata(&client->dev);
const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
int i, ret;
unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
@@ -424,7 +425,8 @@ static int adp5588_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct adp5588_kpad *kpad;
- const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
+ const struct adp5588_kpad_platform_data *pdata =
+ dev_get_platdata(&client->dev);
struct input_dev *input;
unsigned int revid;
int ret, i;
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 60dafd4..ff7725a 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -499,7 +499,7 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad,
static int adp5589_gpio_add(struct adp5589_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
- const struct adp5589_kpad_platform_data *pdata = dev->platform_data;
+ const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
int i, error;
@@ -553,7 +553,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
- const struct adp5589_kpad_platform_data *pdata = dev->platform_data;
+ const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
int error;
@@ -658,7 +658,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
{
struct i2c_client *client = kpad->client;
const struct adp5589_kpad_platform_data *pdata =
- client->dev.platform_data;
+ dev_get_platdata(&client->dev);
u8 (*reg) (u8) = kpad->var->reg;
unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
unsigned char pull_mask = 0;
@@ -864,7 +864,7 @@ static int adp5589_probe(struct i2c_client *client,
{
struct adp5589_kpad *kpad;
const struct adp5589_kpad_platform_data *pdata =
- client->dev.platform_data;
+ dev_get_platdata(&client->dev);
struct input_dev *input;
unsigned int revid;
int ret, i;
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index 09b91d0..16223f4 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -180,7 +180,7 @@ static irqreturn_t bfin_kpad_isr(int irq, void *dev_id)
static int bfin_kpad_probe(struct platform_device *pdev)
{
struct bf54x_kpad *bf54x_kpad;
- struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
+ struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct input_dev *input;
int i, error;
@@ -333,7 +333,7 @@ out:
static int bfin_kpad_remove(struct platform_device *pdev)
{
- struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
+ struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
del_timer_sync(&bf54x_kpad->timer);
diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c
index d15977a..1559dc1 100644
--- a/drivers/input/keyboard/davinci_keyscan.c
+++ b/drivers/input/keyboard/davinci_keyscan.c
@@ -172,7 +172,7 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
struct input_dev *key_dev;
struct resource *res, *mem;
struct device *dev = &pdev->dev;
- struct davinci_ks_platform_data *pdata = pdev->dev.platform_data;
+ struct davinci_ks_platform_data *pdata = dev_get_platdata(&pdev->dev);
int error, i;
if (pdata->device_enable) {
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index 47206bd..e598762 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -244,7 +244,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
if (!keypad)
return -ENOMEM;
- keypad->pdata = pdev->dev.platform_data;
+ keypad->pdata = dev_get_platdata(&pdev->dev);
if (!keypad->pdata) {
err = -EINVAL;
goto failed_free;
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index 328cfc1..34bb358 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -425,7 +425,8 @@ MODULE_DEVICE_TABLE(of, imx_keypad_of_match);
static int imx_keypad_probe(struct platform_device *pdev)
{
- const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
+ const struct matrix_keymap_data *keymap_data =
+ dev_get_platdata(&pdev->dev);
struct imx_keypad *keypad;
struct input_dev *input_dev;
struct resource *res;
diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c
index 0de23f4..0b42118 100644
--- a/drivers/input/keyboard/lm8323.c
+++ b/drivers/input/keyboard/lm8323.c
@@ -627,7 +627,7 @@ static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable);
static int lm8323_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- struct lm8323_platform_data *pdata = client->dev.platform_data;
+ struct lm8323_platform_data *pdata = dev_get_platdata(&client->dev);
struct input_dev *idev;
struct lm8323_chip *lm;
int pwm;
diff --git a/drivers/input/keyboard/lm8333.c b/drivers/input/keyboard/lm8333.c
index 5a8ca35..9081cbe 100644
--- a/drivers/input/keyboard/lm8333.c
+++ b/drivers/input/keyboard/lm8333.c
@@ -131,7 +131,8 @@ static irqreturn_t lm8333_irq_thread(int irq, void *data)
static int lm8333_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct lm8333_platform_data *pdata = client->dev.platform_data;
+ const struct lm8333_platform_data *pdata =
+ dev_get_platdata(&client->dev);
struct lm8333 *lm8333;
struct input_dev *input;
int err, active_time;
diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c
index bc2cdaf..430b545 100644
--- a/drivers/input/keyboard/max7359_keypad.c
+++ b/drivers/input/keyboard/max7359_keypad.c
@@ -182,7 +182,8 @@ static void max7359_initialize(struct i2c_client *client)
static int max7359_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct matrix_keymap_data *keymap_data = client->dev.platform_data;
+ const struct matrix_keymap_data *keymap_data =
+ dev_get_platdata(&client->dev);
struct max7359_keypad *keypad;
struct input_dev *input_dev;
int ret;
diff --git a/drivers/input/keyboard/mcs_touchkey.c b/drivers/input/keyboard/mcs_touchkey.c
index 7c236f9..5ec77523 100644
--- a/drivers/input/keyboard/mcs_touchkey.c
+++ b/drivers/input/keyboard/mcs_touchkey.c
@@ -108,7 +108,7 @@ static int mcs_touchkey_probe(struct i2c_client *client,
int error;
int i;
- pdata = client->dev.platform_data;
+ pdata = dev_get_platdata(&client->dev);
if (!pdata) {
dev_err(&client->dev, "no platform data defined\n");
return -EINVAL;
diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
index f7f3e9a..98b8467 100644
--- a/drivers/input/keyboard/mpr121_touchkey.c
+++ b/drivers/input/keyboard/mpr121_touchkey.c
@@ -188,7 +188,8 @@ err_i2c_write:
static int mpr_touchkey_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct mpr121_platform_data *pdata = client->dev.platform_data;
+ const struct mpr121_platform_data *pdata =
+ dev_get_platdata(&client->dev);
struct mpr121_touchkey *mpr121;
struct input_dev *input_dev;
int error;
diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c
index c7d505c..63332e2 100644
--- a/drivers/input/keyboard/nomadik-ske-keypad.c
+++ b/drivers/input/keyboard/nomadik-ske-keypad.c
@@ -222,7 +222,8 @@ static irqreturn_t ske_keypad_irq(int irq, void *dev_id)
static int __init ske_keypad_probe(struct platform_device *pdev)
{
- const struct ske_keypad_platform_data *plat = pdev->dev.platform_data;
+ const struct ske_keypad_platform_data *plat =
+ dev_get_platdata(&pdev->dev);
struct ske_keypad *keypad;
struct input_dev *input;
struct resource *res;
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index d0d5226..e80bb97 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -248,7 +248,7 @@ static int omap_kp_probe(struct platform_device *pdev)
{
struct omap_kp *omap_kp;
struct input_dev *input_dev;
- struct omap_kp_platform_data *pdata = pdev->dev.platform_data;
+ struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev);
int i, col_idx, row_idx, ret;
unsigned int row_shift, keycodemax;
diff --git a/drivers/input/keyboard/pxa930_rotary.c b/drivers/input/keyboard/pxa930_rotary.c
index 248cdcf..367b03a 100644
--- a/drivers/input/keyboard/pxa930_rotary.c
+++ b/drivers/input/keyboard/pxa930_rotary.c
@@ -84,7 +84,8 @@ static void pxa930_rotary_close(struct input_dev *dev)
static int pxa930_rotary_probe(struct platform_device *pdev)
{
- struct pxa930_rotary_platform_data *pdata = pdev->dev.platform_data;
+ struct pxa930_rotary_platform_data *pdata =
+ dev_get_platdata(&pdev->dev);
struct pxa930_rotary *r;
struct input_dev *input_dev;
struct resource *res;
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index ac43a48..9ac8a1e 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -321,7 +321,7 @@ static int samsung_keypad_probe(struct platform_device *pdev)
if (pdev->dev.of_node)
pdata = samsung_keypad_parse_dt(&pdev->dev);
else
- pdata = pdev->dev.platform_data;
+ pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev, "no platform data defined\n");
return -EINVAL;
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
index fe0e498..d65a98b 100644
--- a/drivers/input/keyboard/sh_keysc.c
+++ b/drivers/input/keyboard/sh_keysc.c
@@ -171,7 +171,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
int i;
int irq, error;
- if (!pdev->dev.platform_data) {
+ if (!dev_get_platdata(&pdev->dev)) {
dev_err(&pdev->dev, "no platform data defined\n");
error = -EINVAL;
goto err0;
@@ -198,7 +198,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, priv);
- memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata));
+ memcpy(&priv->pdata, dev_get_platdata(&pdev->dev), sizeof(priv->pdata));
pdata = &priv->pdata;
priv->iomem_base = ioremap_nocache(res->start, resource_size(res));
diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c
index bfc832c..dc983ab 100644
--- a/drivers/input/keyboard/tca6416-keypad.c
+++ b/drivers/input/keyboard/tca6416-keypad.c
@@ -213,7 +213,7 @@ static int tca6416_keypad_probe(struct i2c_client *client,
return -ENODEV;
}
- pdata = client->dev.platform_data;
+ pdata = dev_get_platdata(&client->dev);
if (!pdata) {
dev_dbg(&client->dev, "no platform data\n");
return -EINVAL;
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c
index 8bd24d5..086511c 100644
--- a/drivers/input/keyboard/tnetv107x-keypad.c
+++ b/drivers/input/keyboard/tnetv107x-keypad.c
@@ -162,7 +162,7 @@ static int keypad_probe(struct platform_device *pdev)
int error = 0, sz, row_shift;
u32 rev = 0;
- pdata = pdev->dev.platform_data;
+ pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(dev, "cannot find device data\n");
return -EINVAL;
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index d2d178c..8bc2879 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -330,7 +330,7 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)
*/
static int twl4030_kp_probe(struct platform_device *pdev)
{
- struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
+ struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev);
const struct matrix_keymap_data *keymap_data;
struct twl4030_keypad *kp;
struct input_dev *input;
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c
index 7b03916..e03614f 100644
--- a/drivers/input/keyboard/w90p910_keypad.c
+++ b/drivers/input/keyboard/w90p910_keypad.c
@@ -121,7 +121,7 @@ static void w90p910_keypad_close(struct input_dev *dev)
static int w90p910_keypad_probe(struct platform_device *pdev)
{
const struct w90p910_keypad_platform_data *pdata =
- pdev->dev.platform_data;
+ dev_get_platdata(&pdev->dev);
const struct matrix_keymap_data *keymap_data;
struct w90p910_keypad *keypad;
struct input_dev *input_dev;
diff --git a/drivers/input/leds.c b/drivers/input/leds.c
index 6bdb51d..99bb05e 100644
--- a/drivers/input/leds.c
+++ b/drivers/input/leds.c
@@ -117,7 +117,7 @@ static void perdevice_input_led_set(struct led_classdev *cdev,
struct led_classdev *leds;
int led;
- dev = cdev->dev->platform_data;
+ dev = dev_get_platdata(cdev->dev);
if (!dev)
/* Still initializing */
return;
diff --git a/drivers/input/misc/ad714x.c b/drivers/input/misc/ad714x.c
index 2e5d5e1..6deecdd 100644
--- a/drivers/input/misc/ad714x.c
+++ b/drivers/input/misc/ad714x.c
@@ -969,7 +969,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
int error;
struct input_dev *input[MAX_DEVICE_NUM];
- struct ad714x_platform_data *plat_data = dev->platform_data;
+ struct ad714x_platform_data *plat_data = dev_get_platdata(dev);
struct ad714x_chip *ad714x;
void *drv_mem;
unsigned long irqflags;
@@ -986,7 +986,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
goto err_out;
}
- if (dev->platform_data == NULL) {
+ if (dev_get_platdata(dev) == NULL) {
dev_err(dev, "platform data for ad714x doesn't exist\n");
error = -EINVAL;
goto err_out;
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index 0735de3..d204997 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -714,7 +714,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
ac->fifo_delay = fifo_delay_default;
- pdata = dev->platform_data;
+ pdata = dev_get_platdata(dev);
if (!pdata) {
dev_dbg(dev,
"No platform data: Using default initialization\n");
diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
index cd139cb..7703447 100644
--- a/drivers/input/misc/bfin_rotary.c
+++ b/drivers/input/misc/bfin_rotary.c
@@ -92,7 +92,7 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)
static int bfin_rotary_probe(struct platform_device *pdev)
{
- struct bfin_rotary_platform_data *pdata = pdev->dev.platform_data;
+ struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct bfin_rot *rotary;
struct input_dev *input;
int error;
diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
index 865c2f9..52d3a9b 100644
--- a/drivers/input/misc/bma150.c
+++ b/drivers/input/misc/bma150.c
@@ -526,7 +526,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
static int bma150_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct bma150_platform_data *pdata = client->dev.platform_data;
+ const struct bma150_platform_data *pdata =
+ dev_get_platdata(&client->dev);
const struct bma150_cfg *cfg;
struct bma150_data *bma150;
int chip_id;
diff --git a/drivers/input/misc/cma3000_d0x.c b/drivers/input/misc/cma3000_d0x.c
index df9b756..c7d0074 100644
--- a/drivers/input/misc/cma3000_d0x.c
+++ b/drivers/input/misc/cma3000_d0x.c
@@ -284,7 +284,7 @@ EXPORT_SYMBOL(cma3000_resume);
struct cma3000_accl_data *cma3000_init(struct device *dev, int irq,
const struct cma3000_bus_ops *bops)
{
- const struct cma3000_platform_data *pdata = dev->platform_data;
+ const struct cma3000_platform_data *pdata = dev_get_platdata(dev);
struct cma3000_accl_data *data;
struct input_dev *input_dev;
int rev;
diff --git a/drivers/input/misc/gp2ap002a00f.c b/drivers/input/misc/gp2ap002a00f.c
index fe30bd0..de21e31 100644
--- a/drivers/input/misc/gp2ap002a00f.c
+++ b/drivers/input/misc/gp2ap002a00f.c
@@ -125,7 +125,7 @@ static int gp2a_initialize(struct gp2a_data *dt)
static int gp2a_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct gp2a_platform_data *pdata = client->dev.platform_data;
+ const struct gp2a_platform_data *pdata = dev_get_platdata(&client->dev);
struct gp2a_data *dt;
int error;
diff --git a/drivers/input/misc/gpio_tilt_polled.c b/drivers/input/misc/gpio_tilt_polled.c
index 714c683..38b3c11 100644
--- a/drivers/input/misc/gpio_tilt_polled.c
+++ b/drivers/input/misc/gpio_tilt_polled.c
@@ -98,7 +98,8 @@ static void gpio_tilt_polled_close(struct input_polled_dev *dev)
static int gpio_tilt_polled_probe(struct platform_device *pdev)
{
- const struct gpio_tilt_platform_data *pdata = pdev->dev.platform_data;
+ const struct gpio_tilt_platform_data *pdata =
+ dev_get_platdata(&pdev->dev);
struct device *dev = &pdev->dev;
struct gpio_tilt_polled_dev *tdev;
struct input_polled_dev *poll_dev;
diff --git a/drivers/input/misc/kxtj9.c b/drivers/input/misc/kxtj9.c
index a993b67..d708478 100644
--- a/drivers/input/misc/kxtj9.c
+++ b/drivers/input/misc/kxtj9.c
@@ -509,7 +509,8 @@ out:
static int kxtj9_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct kxtj9_platform_data *pdata = client->dev.platform_data;
+ const struct kxtj9_platform_data *pdata =
+ dev_get_platdata(&client->dev);
struct kxtj9_data *tj9;
int err;
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index 940566e..8ef288e 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -68,7 +68,7 @@ static int pwm_beeper_event(struct input_dev *input,
static int pwm_beeper_probe(struct platform_device *pdev)
{
- unsigned long pwm_id = (unsigned long)pdev->dev.platform_data;
+ unsigned long pwm_id = (unsigned long)dev_get_platdata(&pdev->dev);
struct pwm_beeper *beeper;
int error;
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c
index 68a5f33..d993775 100644
--- a/drivers/input/misc/twl4030-vibra.c
+++ b/drivers/input/misc/twl4030-vibra.c
@@ -193,7 +193,7 @@ static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata,
static int twl4030_vibra_probe(struct platform_device *pdev)
{
- struct twl4030_vibra_data *pdata = pdev->dev.platform_data;
+ struct twl4030_vibra_data *pdata = dev_get_platdata(&pdev->dev);
struct device_node *twl4030_core_node = pdev->dev.parent->of_node;
struct vibra_info *info;
int ret;
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c
index 6b44413..6810a46 100644
--- a/drivers/input/mouse/gpio_mouse.c
+++ b/drivers/input/mouse/gpio_mouse.c
@@ -48,7 +48,7 @@ static void gpio_mouse_scan(struct input_polled_dev *dev)
static int gpio_mouse_probe(struct platform_device *pdev)
{
- struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data;
+ struct gpio_mouse_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct input_polled_dev *input_poll;
struct input_dev *input;
int pin, i;
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c
index 0ecb9e7..d20d2ae 100644
--- a/drivers/input/mouse/pxa930_trkball.c
+++ b/drivers/input/mouse/pxa930_trkball.c
@@ -166,7 +166,7 @@ static int pxa930_trkball_probe(struct platform_device *pdev)
if (!trkball)
return -ENOMEM;
- trkball->pdata = pdev->dev.platform_data;
+ trkball->pdata = dev_get_platdata(&pdev->dev);
if (!trkball->pdata) {
dev_err(&pdev->dev, "no platform data defined\n");
error = -EINVAL;
diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c
index f7de14a..544e20c 100644
--- a/drivers/input/touchscreen/88pm860x-ts.c
+++ b/drivers/input/touchscreen/88pm860x-ts.c
@@ -172,7 +172,7 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
static int pm860x_touch_probe(struct platform_device *pdev)
{
struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
- struct pm860x_touch_pdata *pdata = pdev->dev.platform_data;
+ struct pm860x_touch_pdata *pdata = dev_get_platdata(&pdev->dev);
struct pm860x_touch *touch;
struct i2c_client *i2c = (chip->id == CHIP_PM8607) ? chip->client \
: chip->companion;
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 69834dd..b9f9bcb 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -686,7 +686,7 @@ static int ad7877_probe(struct spi_device *spi)
{
struct ad7877 *ts;
struct input_dev *input_dev;
- struct ad7877_platform_data *pdata = spi->dev.platform_data;
+ struct ad7877_platform_data *pdata = dev_get_platdata(&spi->dev);
int err;
u16 verify;
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index facd305..a0364d8 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -470,7 +470,7 @@ static int ad7879_gpio_add(struct ad7879 *ts,
static void ad7879_gpio_remove(struct ad7879 *ts)
{
- const struct ad7879_platform_data *pdata = ts->dev->platform_data;
+ const struct ad7879_platform_data *pdata = dev_get_platdata(ts->dev);
int ret;
if (pdata->gpio_export) {
@@ -495,7 +495,7 @@ static inline void ad7879_gpio_remove(struct ad7879 *ts)
struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq,
const struct ad7879_bus_ops *bops)
{
- struct ad7879_platform_data *pdata = dev->platform_data;
+ struct ad7879_platform_data *pdata = dev_get_platdata(dev);
struct ad7879 *ts;
struct input_dev *input_dev;
int err;
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 59aa240..37ea057 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1130,7 +1130,7 @@ static void mxt_input_close(struct input_dev *dev)
static int mxt_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct mxt_platform_data *pdata = client->dev.platform_data;
+ const struct mxt_platform_data *pdata = dev_get_platdata(&client->dev);
struct mxt_data *data;
struct input_dev *input_dev;
int error;
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c
index bddabc5..f7d1ea5 100644
--- a/drivers/input/touchscreen/atmel_tsadcc.c
+++ b/drivers/input/touchscreen/atmel_tsadcc.c
@@ -182,7 +182,7 @@ static int atmel_tsadcc_probe(struct platform_device *pdev)
struct atmel_tsadcc *ts_dev;
struct input_dev *input_dev;
struct resource *res;
- struct at91_tsadcc_data *pdata = pdev->dev.platform_data;
+ struct at91_tsadcc_data *pdata = dev_get_platdata(&pdev->dev);
int err;
unsigned int prsc;
unsigned int reg;
diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 8c65198..5bf1aee 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -178,7 +178,7 @@ static irqreturn_t cy8ctmg110_irq_thread(int irq, void *dev_id)
static int cy8ctmg110_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct cy8ctmg110_pdata *pdata = client->dev.platform_data;
+ const struct cy8ctmg110_pdata *pdata = dev_get_platdata(&client->dev);
struct cy8ctmg110 *ts;
struct input_dev *input_dev;
int err;
diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
index 4204841..eee656f 100644
--- a/drivers/input/touchscreen/cyttsp_core.c
+++ b/drivers/input/touchscreen/cyttsp_core.c
@@ -534,7 +534,7 @@ static void cyttsp_close(struct input_dev *dev)
struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
struct device *dev, int irq, size_t xfer_buf_size)
{
- const struct cyttsp_platform_data *pdata = dev->platform_data;
+ const struct cyttsp_platform_data *pdata = dev_get_platdata(dev);
struct cyttsp *ts;
struct input_dev *input_dev;
int error;
@@ -553,7 +553,7 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
ts->dev = dev;
ts->input = input_dev;
- ts->pdata = dev->platform_data;
+ ts->pdata = dev_get_platdata(dev);
ts->bus_ops = bus_ops;
ts->irq = irq;
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c
index 34ad841..ea0f764 100644
--- a/drivers/input/touchscreen/da9034-ts.c
+++ b/drivers/input/touchscreen/da9034-ts.c
@@ -299,7 +299,7 @@ static void da9034_touch_close(struct input_dev *dev)
static int da9034_touch_probe(struct platform_device *pdev)
{
- struct da9034_touch_pdata *pdata = pdev->dev.platform_data;
+ struct da9034_touch_pdata *pdata = dev_get_platdata(&pdev->dev);
struct da9034_touch *touch;
struct input_dev *input_dev;
int ret;
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 83fa1b1..af0d68b 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -705,7 +705,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct edt_ft5x06_platform_data *pdata =
- client->dev.platform_data;
+ dev_get_platdata(&client->dev);
struct edt_ft5x06_ts_data *tsdata;
struct input_dev *input;
int error;
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 1ce3d29..b1884dd 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -157,7 +157,7 @@ static void eeti_ts_close(struct input_dev *dev)
static int eeti_ts_probe(struct i2c_client *client,
const struct i2c_device_id *idp)
{
- struct eeti_ts_platform_data *pdata = client->dev.platform_data;
+ struct eeti_ts_platform_data *pdata = dev_get_platdata(&client->dev);
struct eeti_ts_priv *priv;
struct input_dev *input;
unsigned int irq_flags;
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 1418bdd..2a50891 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -184,7 +184,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
- const struct ili210x_platform_data *pdata = dev->platform_data;
+ const struct ili210x_platform_data *pdata = dev_get_platdata(dev);
struct ili210x *priv;
struct input_dev *input;
struct panel_info panel;
diff --git a/drivers/input/touchscreen/mcs5000_ts.c b/drivers/input/touchscreen/mcs5000_ts.c
index f9f4e0c..58486f1 100644
--- a/drivers/input/touchscreen/mcs5000_ts.c
+++ b/drivers/input/touchscreen/mcs5000_ts.c
@@ -194,7 +194,7 @@ static int mcs5000_ts_probe(struct i2c_client *client,
struct input_dev *input_dev;
int ret;
- if (!client->dev.platform_data)
+ if (!dev_get_platdata(&client->dev))
return -EINVAL;
data = kzalloc(sizeof(struct mcs5000_ts_data), GFP_KERNEL);
@@ -207,7 +207,7 @@ static int mcs5000_ts_probe(struct i2c_client *client,
data->client = client;
data->input_dev = input_dev;
- data->platform_data = client->dev.platform_data;
+ data->platform_data = dev_get_platdata(&client->dev);
input_dev->name = "MELPAS MCS-5000 Touchscreen";
input_dev->id.bustype = BUS_I2C;
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 6cc6b36..02392d2 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -128,7 +128,8 @@ static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops,
static int pixcir_i2c_ts_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- const struct pixcir_ts_platform_data *pdata = client->dev.platform_data;
+ const struct pixcir_ts_platform_data *pdata =
+ dev_get_platdata(&client->dev);
struct pixcir_i2c_ts_data *tsdata;
struct input_dev *input;
int error;
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index b061af2..d32bd9e 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -251,7 +251,7 @@ static int s3c2410ts_probe(struct platform_device *pdev)
ts.dev = dev;
- info = pdev->dev.platform_data;
+ info = dev_get_platdata(&pdev->dev);
if (!info) {
dev_err(dev, "no platform data, cannot attach\n");
return -EINVAL;
@@ -392,7 +392,7 @@ static int s3c2410ts_suspend(struct device *dev)
static int s3c2410ts_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
- struct s3c2410_ts_mach_info *info = pdev->dev.platform_data;
+ struct s3c2410_ts_mach_info *info = dev_get_platdata(&pdev->dev);
clk_enable(ts.clock);
enable_irq(ts.irq_tc);
diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
index 2f03b2f..5c342b3 100644
--- a/drivers/input/touchscreen/st1232.c
+++ b/drivers/input/touchscreen/st1232.c
@@ -154,7 +154,7 @@ static int st1232_ts_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct st1232_ts_data *ts;
- struct st1232_pdata *pdata = client->dev.platform_data;
+ struct st1232_pdata *pdata = dev_get_platdata(&client->dev);
struct input_dev *input_dev;
int error;
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index 8113533..550adcb 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -571,7 +571,7 @@ static void tsc2005_setup_spi_xfer(struct tsc2005 *ts)
static int tsc2005_probe(struct spi_device *spi)
{
- const struct tsc2005_platform_data *pdata = spi->dev.platform_data;
+ const struct tsc2005_platform_data *pdata = dev_get_platdata(&spi->dev);
struct tsc2005 *ts;
struct input_dev *input_dev;
unsigned int max_x, max_y, max_p;
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index 1271f97..5b3ca80 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -320,7 +320,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb,
static int ucb1400_ts_probe(struct platform_device *pdev)
{
- struct ucb1400_ts *ucb = pdev->dev.platform_data;
+ struct ucb1400_ts *ucb = dev_get_platdata(&pdev->dev);
int error, x_res, y_res;
u16 fcsr;
@@ -399,7 +399,7 @@ err:
static int ucb1400_ts_remove(struct platform_device *pdev)
{
- struct ucb1400_ts *ucb = pdev->dev.platform_data;
+ struct ucb1400_ts *ucb = dev_get_platdata(&pdev->dev);
free_irq(ucb->irq, ucb);
input_unregister_device(ucb->ts_idev);
@@ -410,7 +410,7 @@ static int ucb1400_ts_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int ucb1400_ts_suspend(struct device *dev)
{
- struct ucb1400_ts *ucb = dev->platform_data;
+ struct ucb1400_ts *ucb = dev_get_platdata(dev);
struct input_dev *idev = ucb->ts_idev;
mutex_lock(&idev->mutex);
@@ -424,7 +424,7 @@ static int ucb1400_ts_suspend(struct device *dev)
static int ucb1400_ts_resume(struct device *dev)
{
- struct ucb1400_ts *ucb = dev->platform_data;
+ struct ucb1400_ts *ucb = dev_get_platdata(dev);
struct input_dev *idev = ucb->ts_idev;
mutex_lock(&idev->mutex);
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index 7e45c9f..d0ef91f 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -584,7 +584,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev)
static int wm97xx_probe(struct device *dev)
{
struct wm97xx *wm;
- struct wm97xx_pdata *pdata = dev->platform_data;
+ struct wm97xx_pdata *pdata = dev_get_platdata(dev);
int ret = 0, id = 0;
wm = kzalloc(sizeof(struct wm97xx), GFP_KERNEL);
--
1.7.10.4
^ permalink raw reply related
* [PATCH] input synaptics-rmi4: Remove sysfs & debugfs stuff
From: Christopher Heiny @ 2013-12-03 0:52 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Linux Input, Christopher Heiny, Andrew Duggan, Vincent Huang,
Vivian Ly, Daniel Rosenberg, Jean Delvare, Joerie de Gram,
Linus Walleij, Benjamin Tissoires
This patch implements changes to the synaptics-rmi4 branch of
Dmitry's input tree. The base for the patchset is Dmitry's commit
4a695a01fba9bf467b3b52e124ccee6cef73b323 from 2013-01-31.
Removed all of the sysfs and most of the debugfs support from the driver core
and function drivers. The code is still horribly broken (as previously
advertised) but should now be easier to work with. A few lines are reformatted
for line-length issues.
Signed-off-by: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Linus Walleij <linus.walleij@stericsson.com>
Cc: Joerie de Gram <j.de.gram@gmail.com>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/input/rmi4/rmi_bus.h | 11 -
drivers/input/rmi4/rmi_driver.c | 175 +--------
drivers/input/rmi4/rmi_f01.c | 787 +---------------------------------------
drivers/input/rmi4/rmi_f11.c | 183 ----------
drivers/input/rmi4/rmi_i2c.c | 6 +-
5 files changed, 9 insertions(+), 1153 deletions(-)
diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
index 33e8f1b..e2a3dc6 100644
--- a/drivers/input/rmi4/rmi_bus.h
+++ b/drivers/input/rmi4/rmi_bus.h
@@ -22,17 +22,6 @@
#include <linux/debugfs.h>
#include <linux/rmi.h>
-
-/* Permissions for sysfs attributes. Since the permissions policy will change
- * on a global basis in the future, rather than edit all sysfs attrs everywhere
- * in the driver (and risk screwing that up in the process), we use this handy
- * set of #defines. That way when we change the policy for sysfs permissions,
- * we only need to change them here.
- */
-#define RMI_RO_ATTR S_IRUGO
-#define RMI_RW_ATTR (S_IRUGO | S_IWUGO)
-#define RMI_WO_ATTR S_IWUGO
-
struct rmi_device;
/**
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 5cf7b33..132cd52 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -4,9 +4,10 @@
*
* This driver provides the core support for a single RMI4-based device.
*
- * The RMI4 specification can be found here:
+ * The RMI4 specification can be found here (URL split for line length):
*
- * http://www.synaptics.com/sites/default/files/511-000136-01-Rev-E-RMI4%20Intrfacing%20Guide.pdf
+ * http://www.synaptics.com/sites/default/files/
+ * 511-000136-01-Rev-E-RMI4%20Intrfacing%20Guide.pdf
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
@@ -42,48 +43,6 @@
#define IRQ_DEBUG(data) (IS_ENABLED(CONFIG_RMI4_DEBUG) && data->irq_debug)
-#ifdef CONFIG_RMI4_DEBUG
-static void rmi_driver_setup_debugfs(struct rmi_device *rmi_dev)
-{
- struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
- struct rmi_phys_info *info = &rmi_dev->phys->info;
-
- if (!rmi_dev->debugfs_root)
- return;
-
- if (!debugfs_create_u32_array("transport_stats", RMI_RO_ATTR,
- rmi_dev->debugfs_root,
- (u32 *)&info->tx_count, 6))
- dev_warn(&rmi_dev->dev,
- "Failed to create debugfs transport_stats\n");
-
- if (!debugfs_create_bool("irq_debug", RMI_RW_ATTR,
- rmi_dev->debugfs_root,
- &data->irq_debug))
- dev_warn(&rmi_dev->dev, "Failed to create debugfs irq_debug\n");
-
- if (!debugfs_create_u32("attn_count", RMI_RO_ATTR,
- rmi_dev->debugfs_root,
- &data->attn_count))
- dev_warn(&rmi_dev->dev,
- "Failed to create debugfs attn_count\n");
-}
-
-static void rmi_driver_teardown_debugfs(struct rmi_device *rmi_dev)
-{
- debugfs_remove_recursive(rmi_dev->debugfs_root);
-}
-
-#else
-static inline void rmi_driver_setup_debugfs(struct rmi_device *rmi_dev)
-{
-}
-
-static inline rmi_driver_teardown_debugfs(struct rmi_device *rmi_dev)
-{
-}
-#endif
-
static irqreturn_t rmi_irq_thread(int irq, void *p)
{
struct rmi_phys_device *phys = p;
@@ -217,122 +176,6 @@ static int enable_sensor(struct rmi_device *rmi_dev)
return retval;
}
-/* sysfs show and store fns for driver attributes */
-
-static ssize_t rmi_driver_bsr_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_device *rmi_dev;
- struct rmi_driver_data *data;
- rmi_dev = to_rmi_device(dev);
- data = dev_get_drvdata(&rmi_dev->dev);
-
- return snprintf(buf, PAGE_SIZE, "%u\n", data->bsr);
-}
-
-static ssize_t rmi_driver_bsr_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- int retval;
- unsigned long val;
- struct rmi_device *rmi_dev;
- struct rmi_driver_data *data;
-
- rmi_dev = to_rmi_device(dev);
- data = dev_get_drvdata(&rmi_dev->dev);
-
- /* need to convert the string data to an actual value */
- retval = strict_strtoul(buf, 10, &val);
- if (retval < 0 || val > 255) {
- dev_err(dev, "Invalid value '%s' written to BSR.\n", buf);
- return -EINVAL;
- }
-
- retval = rmi_write(rmi_dev, BSR_LOCATION, (u8)val);
- if (retval < 0) {
- dev_err(dev, "%s : failed to write bsr %lu to %#06x\n",
- __func__, val, BSR_LOCATION);
- return retval;
- }
-
- data->bsr = val;
-
- return count;
-}
-
-static DEVICE_ATTR(bsr, RMI_RW_ATTR, rmi_driver_bsr_show, rmi_driver_bsr_store);
-
-static ssize_t rmi_driver_enabled_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_device *rmi_dev = to_rmi_device(dev);
- struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
-
- return snprintf(buf, PAGE_SIZE, "%u\n", data->enabled);
-}
-
-static ssize_t rmi_driver_enabled_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_device *rmi_dev = to_rmi_device(dev);
- int retval;
- int new_value;
-
- if (sysfs_streq(buf, "0"))
- new_value = false;
- else if (sysfs_streq(buf, "1"))
- new_value = true;
- else
- return -EINVAL;
-
- if (new_value) {
- retval = enable_sensor(rmi_dev);
- if (retval) {
- dev_err(dev, "Failed to enable sensor, code=%d.\n",
- retval);
- return -EIO;
- }
- } else {
- disable_sensor(rmi_dev);
- }
-
- return count;
-}
-
-/** This sysfs attribute is deprecated, and will be removed in a future release.
- */
-static DEVICE_ATTR(enabled, RMI_RW_ATTR,
- rmi_driver_enabled_show, rmi_driver_enabled_store);
-
-static umode_t rmi_driver_attr_visible(struct kobject *kobj,
- struct attribute *attr, int n)
-{
- struct device *dev = kobj_to_dev(kobj);
- struct rmi_device *rmi_dev = to_rmi_device(dev);
- struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
- umode_t mode = attr->mode;
-
- if (attr == &dev_attr_bsr.attr) {
- if (!data->pdt_props.has_bsr)
- mode = 0;
- }
-
- return mode;
-}
-
-static struct attribute *rmi_driver_attrs[] = {
- &dev_attr_bsr.attr,
- &dev_attr_enabled.attr,
- NULL
-};
-
-static struct attribute_group rmi_driver_attr_group = {
- .is_visible = rmi_driver_attr_visible,
- .attrs = rmi_driver_attrs,
-};
-
static void rmi_free_function_list(struct rmi_device *rmi_dev)
{
struct rmi_function *fn, *tmp;
@@ -718,7 +561,8 @@ static int reset_and_reflash(struct rmi_device *rmi_dev)
bool has_f01 = false;
int i;
int retval;
- const struct rmi_device_platform_data *pdata = to_rmi_platform_data(rmi_dev);
+ const struct rmi_device_platform_data *pdata =
+ to_rmi_platform_data(rmi_dev);
dev_dbg(dev, "Initial reset.\n");
@@ -941,7 +785,6 @@ static int rmi_driver_remove(struct device *dev)
struct rmi_device *rmi_dev = to_rmi_device(dev);
rmi_driver_teardown_debugfs(rmi_dev);
- sysfs_remove_group(&dev->kobj, &rmi_driver_attr_group);
disable_sensor(rmi_dev);
rmi_free_function_list(rmi_dev);
@@ -1079,14 +922,6 @@ static int rmi_driver_probe(struct device *dev)
mutex_init(&data->suspend_mutex);
}
- retval = sysfs_create_group(&dev->kobj, &rmi_driver_attr_group);
- if (retval < 0) {
- dev_err(dev, "%s: Failed to create sysfs group\n", __func__);
- goto err_free_data;
- }
-
- rmi_driver_setup_debugfs(rmi_dev);
-
if (pdata->attn_gpio) {
data->irq = gpio_to_irq(pdata->attn_gpio);
if (pdata->level_triggered) {
diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index fe26869..840a8d0 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -8,7 +8,6 @@
*/
#include <linux/kernel.h>
-#include <linux/debugfs.h>
#include <linux/kconfig.h>
#include <linux/rmi.h>
#include <linux/slab.h>
@@ -143,780 +142,6 @@ struct f01_data {
bool suspended;
bool old_nosleep;
#endif
-
-#ifdef CONFIG_RMI4_DEBUG
- struct dentry *debugfs_interrupt_enable;
-#endif
-};
-
-#ifdef CONFIG_RMI4_DEBUG
-struct f01_debugfs_data {
- bool done;
- struct rmi_function *fn;
-};
-
-static int f01_debug_open(struct inode *inodep, struct file *filp)
-{
- struct f01_debugfs_data *data;
- struct rmi_function *fn = inodep->i_private;
-
- data = kzalloc(sizeof(struct f01_debugfs_data), GFP_KERNEL);
- if (!data)
- return -ENOMEM;
-
- data->fn = fn;
- filp->private_data = data;
- return 0;
-}
-
-static int f01_debug_release(struct inode *inodep, struct file *filp)
-{
- kfree(filp->private_data);
- return 0;
-}
-
-static ssize_t interrupt_enable_read(struct file *filp, char __user *buffer,
- size_t size, loff_t *offset) {
- int i;
- int len;
- int total_len = 0;
- char local_buf[size]; // FIXME!!!! XXX arbitrary size array on stack
- char *current_buf = local_buf;
- struct f01_debugfs_data *data = filp->private_data;
- struct f01_data *f01 = data->fn->data;
-
- if (data->done)
- return 0;
-
- data->done = 1;
-
- /* loop through each irq value and copy its
- * string representation into buf */
- for (i = 0; i < f01->irq_count; i++) {
- int irq_reg;
- int irq_shift;
- int interrupt_enable;
-
- irq_reg = i / 8;
- irq_shift = i % 8;
- interrupt_enable =
- ((f01->device_control.interrupt_enable[irq_reg]
- >> irq_shift) & 0x01);
-
- /* get next irq value and write it to buf */
- len = snprintf(current_buf, size - total_len,
- "%u ", interrupt_enable);
- /* bump up ptr to next location in buf if the
- * snprintf was valid. Otherwise issue an error
- * and return. */
- if (len > 0) {
- current_buf += len;
- total_len += len;
- } else {
- dev_err(&data->fn->dev, "Failed to build interrupt_enable buffer, code = %d.\n",
- len);
- return snprintf(local_buf, size, "unknown\n");
- }
- }
- len = snprintf(current_buf, size - total_len, "\n");
- if (len > 0)
- total_len += len;
- else
- dev_warn(&data->fn->dev, "%s: Failed to append carriage return.\n",
- __func__);
-
- if (copy_to_user(buffer, local_buf, total_len))
- return -EFAULT;
-
- return total_len;
-}
-
-static ssize_t interrupt_enable_write(struct file *filp,
- const char __user *buffer, size_t size, loff_t *offset) {
- int retval;
- char buf[size];
- char *local_buf = buf;
- int i;
- int irq_count = 0;
- int irq_reg = 0;
- struct f01_debugfs_data *data = filp->private_data;
- struct f01_data *f01 = data->fn->data;
-
- retval = copy_from_user(buf, buffer, size);
- if (retval)
- return -EFAULT;
-
- for (i = 0; i < f01->irq_count && *local_buf != 0;
- i++, local_buf += 2) {
- int irq_shift;
- int interrupt_enable;
- int result;
-
- irq_reg = i / 8;
- irq_shift = i % 8;
-
- /* get next interrupt mapping value and store and bump up to
- * point to next item in local_buf */
- result = sscanf(local_buf, "%u", &interrupt_enable);
- if ((result != 1) ||
- (interrupt_enable != 0 && interrupt_enable != 1)) {
- dev_err(&data->fn->dev, "Interrupt enable[%d] is not a valid value 0x%x.\n",
- i, interrupt_enable);
- return -EINVAL;
- }
- if (interrupt_enable == 0) {
- f01->device_control.interrupt_enable[irq_reg] &=
- (1 << irq_shift) ^ 0xFF;
- } else
- f01->device_control.interrupt_enable[irq_reg] |=
- (1 << irq_shift);
- irq_count++;
- }
-
- /* Make sure the irq count matches */
- if (irq_count != f01->irq_count) {
- dev_err(&data->fn->dev, "Interrupt enable count of %d doesn't match device count of %d.\n",
- irq_count, f01->irq_count);
- return -EINVAL;
- }
-
- /* write back to the control register */
- retval = rmi_write_block(data->fn->rmi_dev, f01->interrupt_enable_addr,
- f01->device_control.interrupt_enable,
- f01->num_of_irq_regs);
- if (retval < 0) {
- dev_err(&data->fn->dev, "Could not write interrupt_enable mask to %#06x\n",
- f01->interrupt_enable_addr);
- return retval;
- }
-
- return size;
-}
-
-static const struct file_operations interrupt_enable_fops = {
- .owner = THIS_MODULE,
- .open = f01_debug_open,
- .release = f01_debug_release,
- .read = interrupt_enable_read,
- .write = interrupt_enable_write,
-};
-
-static int setup_debugfs(struct rmi_function *fn)
-{
- struct f01_data *data = fn->data;
-
- if (!fn->debugfs_root)
- return -ENODEV;
-
- data->debugfs_interrupt_enable = debugfs_create_file("interrupt_enable",
- RMI_RW_ATTR, fn->debugfs_root, fn, &interrupt_enable_fops);
- if (!data->debugfs_interrupt_enable)
- dev_warn(&fn->dev,
- "Failed to create debugfs interrupt_enable.\n");
-
- return 0;
-}
-
-static void teardown_debugfs(struct f01_data *f01)
-{
- if (f01->debugfs_interrupt_enable)
- debugfs_remove(f01->debugfs_interrupt_enable);
-}
-
-#else
-
-static inline int setup_debugfs(struct rmi_function *fn)
-{
- return 0;
-}
-
-static inline void teardown_debugfs(struct f01_data *f01)
-{
-}
-
-#endif
-
-static ssize_t rmi_fn_01_productinfo_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "0x%04x\n",
- data->properties.productinfo);
-}
-
-static ssize_t rmi_fn_01_productid_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "%s\n", data->properties.product_id);
-}
-
-static ssize_t rmi_fn_01_manufacturer_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "0x%02x\n",
- data->properties.manufacturer_id);
-}
-
-static ssize_t rmi_fn_01_datecode_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "%s\n", data->properties.dom);
-}
-
-static ssize_t rmi_fn_01_reset_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- unsigned int reset;
- int error;
-
- if (sscanf(buf, "%u", &reset) != 1)
- return -EINVAL;
- if (reset < 0 || reset > 1)
- return -EINVAL;
-
- /* Per spec, 0 has no effect, so we skip it entirely. */
- if (reset) {
- /* Command register always reads as 0, so just use a local. */
- u8 command = RMI_F01_CMD_DEVICE_RESET;
-
- error = rmi_write_block(fn->rmi_dev, fn->fd.command_base_addr,
- &command, sizeof(command));
- if (error < 0) {
- dev_err(dev, "Failed to issue reset command, code = %d.",
- error);
- return error;
- }
- }
-
- return count;
-}
-
-static ssize_t rmi_fn_01_sleepmode_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned int value = data->device_control.ctrl0 &
- RMI_F01_CTRL0_SLEEP_MODE_MASK;
-
- return snprintf(buf, PAGE_SIZE, "%d\n", value);
-}
-
-static ssize_t rmi_fn_01_sleepmode_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned long new_value;
- int retval;
-
- retval = strict_strtoul(buf, 10, &new_value);
- if (retval < 0 || !RMI_IS_VALID_SLEEPMODE(new_value)) {
- dev_err(dev, "%s: Invalid sleep mode %s.", __func__, buf);
- return -EINVAL;
- }
-
- retval = mutex_lock_interruptible(&data->control_mutex);
- if (retval)
- return retval;
-
- dev_dbg(dev, "Setting sleep mode to %ld.", new_value);
-
- data->device_control.ctrl0 &= ~RMI_F01_CTRL0_SLEEP_MODE_MASK;
- data->device_control.ctrl0 |= new_value;
-
- retval = rmi_write_block(fn->rmi_dev, fn->fd.control_base_addr,
- &data->device_control.ctrl0,
- sizeof(data->device_control.ctrl0));
- if (retval >= 0)
- retval = count;
- else
- dev_err(dev, "Failed to write sleep mode, code %d.\n", retval);
-
- mutex_unlock(&data->control_mutex);
- return retval;
-}
-
-static ssize_t rmi_fn_01_nosleep_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned int value = !!(data->device_control.ctrl0 &
- RMI_F01_CRTL0_NOSLEEP_BIT);
-
- return snprintf(buf, PAGE_SIZE, "%d\n", value);
-}
-
-static ssize_t rmi_fn_01_nosleep_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned long new_value;
- int retval;
-
- retval = strict_strtoul(buf, 10, &new_value);
- if (retval < 0 || new_value > 1) {
- dev_err(dev, "%s: Invalid nosleep bit %s.", __func__, buf);
- return -EINVAL;
- }
-
- retval = mutex_lock_interruptible(&data->control_mutex);
- if (retval)
- return retval;
-
- if (new_value)
- data->device_control.ctrl0 |= RMI_F01_CRTL0_NOSLEEP_BIT;
- else
- data->device_control.ctrl0 &= ~RMI_F01_CRTL0_NOSLEEP_BIT;
-
- retval = rmi_write_block(fn->rmi_dev, fn->fd.control_base_addr,
- &data->device_control.ctrl0,
- sizeof(data->device_control.ctrl0));
- if (retval >= 0)
- retval = count;
- else
- dev_err(dev, "Failed to write nosleep bit.\n");
-
- mutex_unlock(&data->control_mutex);
- return retval;
-}
-
-static ssize_t rmi_fn_01_chargerinput_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned int value = !!(data->device_control.ctrl0 &
- RMI_F01_CRTL0_CHARGER_BIT);
-
- return snprintf(buf, PAGE_SIZE, "%d\n", value);
-}
-
-static ssize_t rmi_fn_01_chargerinput_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned long new_value;
- int retval;
-
- retval = strict_strtoul(buf, 10, &new_value);
- if (retval < 0 || new_value > 1) {
- dev_err(dev, "%s: Invalid chargerinput bit %s.", __func__, buf);
- return -EINVAL;
- }
-
- retval = mutex_lock_interruptible(&data->control_mutex);
- if (retval)
- return retval;
-
- if (new_value)
- data->device_control.ctrl0 |= RMI_F01_CRTL0_CHARGER_BIT;
- else
- data->device_control.ctrl0 &= ~RMI_F01_CRTL0_CHARGER_BIT;
-
- retval = rmi_write_block(fn->rmi_dev, fn->fd.control_base_addr,
- &data->device_control.ctrl0,
- sizeof(data->device_control.ctrl0));
- if (retval >= 0)
- retval = count;
- else
- dev_err(dev, "Failed to write chargerinput bit.\n");
-
- mutex_unlock(&data->control_mutex);
- return retval;
-}
-
-static ssize_t rmi_fn_01_reportrate_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- int value = !!(data->device_control.ctrl0 &
- RMI_F01_CRTL0_REPORTRATE_BIT);
-
- return snprintf(buf, PAGE_SIZE, "%d\n", value);
-}
-
-static ssize_t rmi_fn_01_reportrate_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned long new_value;
- int retval;
-
- retval = strict_strtoul(buf, 10, &new_value);
- if (retval < 0 || new_value > 1) {
- dev_err(dev, "%s: Invalid reportrate bit %s.", __func__, buf);
- return -EINVAL;
- }
-
- retval = mutex_lock_interruptible(&data->control_mutex);
- if (retval)
- return retval;
-
- if (new_value)
- data->device_control.ctrl0 |= RMI_F01_CRTL0_REPORTRATE_BIT;
- else
- data->device_control.ctrl0 &= ~RMI_F01_CRTL0_REPORTRATE_BIT;
-
- retval = rmi_write_block(fn->rmi_dev, fn->fd.control_base_addr,
- &data->device_control.ctrl0,
- sizeof(data->device_control.ctrl0));
- if (retval >= 0)
- retval = count;
- else
- dev_err(dev, "Failed to write reportrate bit.\n");
-
- mutex_unlock(&data->control_mutex);
- return retval;
-}
-
-static ssize_t rmi_fn_01_interrupt_enable_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- int i, len, total_len = 0;
- char *current_buf = buf;
-
- /* loop through each irq value and copy its
- * string representation into buf */
- for (i = 0; i < data->irq_count; i++) {
- int irq_reg;
- int irq_shift;
- int interrupt_enable;
-
- irq_reg = i / 8;
- irq_shift = i % 8;
- interrupt_enable =
- ((data->device_control.interrupt_enable[irq_reg]
- >> irq_shift) & 0x01);
-
- /* get next irq value and write it to buf */
- len = snprintf(current_buf, PAGE_SIZE - total_len,
- "%u ", interrupt_enable);
- /* bump up ptr to next location in buf if the
- * snprintf was valid. Otherwise issue an error
- * and return. */
- if (len > 0) {
- current_buf += len;
- total_len += len;
- } else {
- dev_err(dev, "Failed to build interrupt_enable buffer, code = %d.\n",
- len);
- return snprintf(buf, PAGE_SIZE, "unknown\n");
- }
- }
- len = snprintf(current_buf, PAGE_SIZE - total_len, "\n");
- if (len > 0)
- total_len += len;
- else
- dev_warn(dev, "%s: Failed to append carriage return.\n",
- __func__);
- return total_len;
-
-}
-
-static ssize_t rmi_fn_01_doze_interval_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- data->device_control.doze_interval);
-
-}
-
-static ssize_t rmi_fn_01_doze_interval_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned long new_value;
- int retval;
- u16 ctrl_base_addr;
-
- retval = strict_strtoul(buf, 10, &new_value);
- if (retval < 0 || new_value > 255) {
- dev_err(dev, "%s: Invalid doze interval %s.", __func__, buf);
- return -EINVAL;
- }
-
- retval = mutex_lock_interruptible(&data->control_mutex);
- if (retval)
- return retval;
-
- data->device_control.doze_interval = new_value;
- ctrl_base_addr = fn->fd.control_base_addr + sizeof(u8) +
- (sizeof(u8)*(data->num_of_irq_regs));
- dev_dbg(dev, "doze_interval store address %x, value %d",
- ctrl_base_addr, data->device_control.doze_interval);
-
- retval = rmi_write_block(fn->rmi_dev, data->doze_interval_addr,
- &data->device_control.doze_interval,
- sizeof(u8));
- if (retval >= 0)
- retval = count;
- else
- dev_err(dev, "Failed to write doze interval.\n");
-
- mutex_unlock(&data->control_mutex);
- return retval;
-}
-
-static ssize_t rmi_fn_01_wakeup_threshold_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- data->device_control.wakeup_threshold);
-}
-
-static ssize_t rmi_fn_01_wakeup_threshold_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned long new_value;
- int retval;
-
- retval = strict_strtoul(buf, 10, &new_value);
- if (retval < 0 || new_value > 255) {
- dev_err(dev, "%s: Invalid wakeup threshold %s.", __func__, buf);
- return -EINVAL;
- }
-
- retval = mutex_lock_interruptible(&data->control_mutex);
- if (retval)
- return retval;
-
- data->device_control.doze_interval = new_value;
- retval = rmi_write_block(fn->rmi_dev, data->wakeup_threshold_addr,
- &data->device_control.wakeup_threshold,
- sizeof(u8));
- if (retval >= 0)
- retval = count;
- else
- dev_err(dev, "Failed to write wakeup threshold.\n");
-
- mutex_unlock(&data->control_mutex);
- return retval;
-}
-
-static ssize_t rmi_fn_01_doze_holdoff_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- data->device_control.doze_holdoff);
-
-}
-
-static ssize_t rmi_fn_01_doze_holdoff_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned long new_value;
- int retval;
-
- retval = strict_strtoul(buf, 10, &new_value);
- if (retval < 0 || new_value > 255) {
- dev_err(dev, "%s: Invalid doze holdoff %s.", __func__, buf);
- return -EINVAL;
- }
-
- retval = mutex_lock_interruptible(&data->control_mutex);
- if (retval)
- return retval;
-
- data->device_control.doze_interval = new_value;
- retval = rmi_write_block(fn->rmi_dev, data->doze_holdoff_addr,
- &data->device_control.doze_holdoff,
- sizeof(u8));
- if (retval >= 0)
- retval = count;
- else
- dev_err(dev, "Failed to write doze holdoff.\n");
-
- mutex_unlock(&data->control_mutex);
- return retval;
-}
-
-static ssize_t rmi_fn_01_configured_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- unsigned int value = !!(data->device_control.ctrl0 &
- RMI_F01_CRTL0_CONFIGURED_BIT);
-
- return snprintf(buf, PAGE_SIZE, "%d\n", value);
-}
-
-static ssize_t rmi_fn_01_unconfigured_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- RMI_F01_STATUS_UNCONFIGURED(data->device_status));
-}
-
-static ssize_t rmi_fn_01_flashprog_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "%d\n",
- RMI_F01_STATUS_BOOTLOADER(data->device_status));
-}
-
-static ssize_t rmi_fn_01_statuscode_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
-
- return snprintf(buf, PAGE_SIZE, "0x%02x\n",
- RMI_F01_STATUS_CODE(data->device_status));
-}
-
-#define RMI_F01_ATTR(_name) \
- DEVICE_ATTR(_name, RMI_RW_ATTR, \
- rmi_fn_01_##_name##_show, \
- rmi_fn_01_##_name##_store)
-
-#define RMI_F01_RO_ATTR(_name) \
- DEVICE_ATTR(_name, RMI_RO_ATTR, \
- rmi_fn_01_##_name##_show, \
- NULL)
-
-#define RMI_F01_WO_ATTR(_name) \
- DEVICE_ATTR(_name, RMI_RO_ATTR, \
- NULL, \
- rmi_fn_01_##_name##_store)
-
-
-static RMI_F01_RO_ATTR(productinfo);
-static RMI_F01_RO_ATTR(productid);
-static RMI_F01_RO_ATTR(manufacturer);
-static RMI_F01_RO_ATTR(datecode);
-
-/* Control register access */
-static RMI_F01_ATTR(sleepmode);
-static RMI_F01_ATTR(nosleep);
-static RMI_F01_ATTR(chargerinput);
-static RMI_F01_ATTR(reportrate);
-
-/*
- * We don't want arbitrary callers changing the interrupt enable mask,
- * so it's read only.
- */
-static RMI_F01_RO_ATTR(interrupt_enable);
-static RMI_F01_ATTR(doze_interval);
-static RMI_F01_ATTR(wakeup_threshold);
-static RMI_F01_ATTR(doze_holdoff);
-
-/*
- * We make 'configured' RO, since the driver uses that to look for
- * resets. We don't want someone faking us out by changing that
- * bit.
- */
-static RMI_F01_RO_ATTR(configured);
-
-/* Command register access. */
-static RMI_F01_WO_ATTR(reset);
-
-/* Status register access. */
-static RMI_F01_RO_ATTR(unconfigured);
-static RMI_F01_RO_ATTR(flashprog);
-static RMI_F01_RO_ATTR(statuscode);
-
-static struct attribute *rmi_fn_01_attrs[] = {
- &dev_attr_productinfo.attr,
- &dev_attr_productid.attr,
- &dev_attr_manufacturer.attr,
- &dev_attr_datecode.attr,
- &dev_attr_sleepmode.attr,
- &dev_attr_nosleep.attr,
- &dev_attr_chargerinput.attr,
- &dev_attr_reportrate.attr,
- &dev_attr_interrupt_enable.attr,
- &dev_attr_doze_interval.attr,
- &dev_attr_wakeup_threshold.attr,
- &dev_attr_doze_holdoff.attr,
- &dev_attr_configured.attr,
- &dev_attr_reset.attr,
- &dev_attr_unconfigured.attr,
- &dev_attr_flashprog.attr,
- &dev_attr_statuscode.attr,
- NULL
-};
-
-static umode_t rmi_fn_01_attr_visible(struct kobject *kobj,
- struct attribute *attr, int n)
-{
- struct device *dev = kobj_to_dev(kobj);
- struct rmi_function *fn = to_rmi_function(dev);
- struct f01_data *data = fn->data;
- umode_t mode = attr->mode;
-
- if (attr == &dev_attr_doze_interval.attr) {
- if (!data->properties.has_lts)
- mode = 0;
- } else if (attr == &dev_attr_wakeup_threshold.attr) {
- if (!data->properties.has_adjustable_doze)
- mode = 0;
- } else if (attr == &dev_attr_doze_holdoff.attr) {
- if (!data->properties.has_adjustable_doze_holdoff)
- mode = 0;
- }
-
- return mode;
-}
-
-static struct attribute_group rmi_fn_01_attr_group = {
- .is_visible = rmi_fn_01_attr_visible,
- .attrs = rmi_fn_01_attrs,
};
static int rmi_f01_alloc_memory(struct rmi_function *fn,
@@ -1148,11 +373,6 @@ static int rmi_f01_initialize(struct rmi_function *fn)
goto error_exit;
}
- error = setup_debugfs(fn);
- if (error)
- dev_warn(&fn->dev, "Failed to setup debugfs, error: %d.\n",
- error);
-
return 0;
error_exit:
@@ -1228,17 +448,12 @@ static int rmi_f01_probe(struct rmi_function *fn)
if (error)
return error;
- error = sysfs_create_group(&fn->dev.kobj, &rmi_fn_01_attr_group);
- if (error)
- return error;
-
return 0;
}
static void rmi_f01_remove(struct rmi_function *fn)
{
- teardown_debugfs(fn->data);
- sysfs_remove_group(&fn->dev.kobj, &rmi_fn_01_attr_group);
+ /* Placeholder for now. */
}
#ifdef CONFIG_PM_SLEEP
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index 017c8ff..8984054 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -10,7 +10,6 @@
#define FUNCTION_DATA f11_data
#include <linux/kernel.h>
-#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/input.h>
@@ -822,177 +821,6 @@ enum finger_state_values {
F11_RESERVED = 0x03
};
-static ssize_t rmi_f11_rezero_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct rmi_function *fn = to_rmi_function(dev);
- unsigned int rezero;
- int error;
-
- error = kstrtouint(buf, 0, &rezero);
- if (error)
- return error;
-
- if (rezero > 1)
- return -ERANGE;
-
- /* Per spec, 0 has no effect, so we skip it entirely. */
- if (rezero) {
- /* Command register always reads as 0, so just use a local. */
- struct f11_2d_commands commands = {
- .rezero = true,
- };
-
- error = rmi_write_block(fn->rmi_dev, fn->fd.command_base_addr,
- &commands, sizeof(commands));
- if (error < 0) {
- dev_err(dev,
- "%s: failed to issue rezero command, error = %d.",
- __func__, error);
- return error;
- }
- }
-
- return count;
-}
-
-static DEVICE_ATTR(rezero, RMI_WO_ATTR, NULL, rmi_f11_rezero_store);
-
-static struct attribute *rmi_f11_attrs[] = {
- &dev_attr_rezero.attr,
- NULL
-};
-
-static struct attribute_group rmi_f11_attr_group = {
- .attrs = rmi_f11_attrs,
-};
-
-#ifdef CONFIG_RMI4_DEBUG
-static void rmi_f11_setup_sensor_debugfs(struct f11_2d_sensor *sensor)
-{
- struct rmi_function *fn = sensor->fn;
- struct dentry *sensor_root;
- char dirname[sizeof("sensorNNN")];
-
- if (!fn->debugfs_root)
- return;
-
- snprintf(dirname, sizeof(dirname), "input%3u", sensor->sensor_index);
- sensor_root = debugfs_create_dir(dirname, fn->debugfs_root);
- if (!sensor_root) {
- dev_warn(&fn->dev,
- "Failed to create debugfs directory %s for sensor %d\n",
- dirname, sensor->sensor_index);
- return;
- }
-
- if (!debugfs_create_bool("type_a", RMI_RW_ATTR, sensor_root,
- &sensor->type_a))
- dev_warn(&fn->dev,
- "Failed to create debugfs type_a for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u16("max_x", RMI_RW_ATTR, sensor_root,
- &sensor->max_x))
- dev_warn(&fn->dev,
- "Failed to create debugfs max_x for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u16("max_xy", RMI_RW_ATTR, sensor_root,
- &sensor->max_y))
- dev_warn(&fn->dev,
- "Failed to create debugfs max_y for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_bool("flip_x", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.flip_x))
- dev_warn(&fn->dev,
- "Failed to create debugfs flip_x for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_bool("flip_y", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.flip_y))
- dev_warn(&fn->dev,
- "Failed to create debugfs flip_y for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u16("clip_x_low", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.clip_x_low))
- dev_warn(&fn->dev,
- "Failed to create debugfs clip_x_low for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u16("clip_x_high", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.clip_x_high))
- dev_warn(&fn->dev,
- "Failed to create debugfs clip_x_high for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u16("clip_y_low", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.clip_y_low))
- dev_warn(&fn->dev,
- "Failed to create debugfs clip_y_low for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u16("clip_y_high", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.clip_y_high))
- dev_warn(&fn->dev,
- "Failed to create debugfs clip_y_high for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u8("delta_x_threshold", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.delta_x_threshold))
- dev_warn(&fn->dev,
- "Failed to create debugfs delta_x_threshold for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u8("delta_y_threshold", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.delta_y_threshold))
- dev_warn(&fn->dev,
- "Failed to create debugfs delta_y_threshold for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u16("offset_x", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.offset_x))
- dev_warn(&fn->dev,
- "Failed to create debugfs offset_x for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_u16("offset_x", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.offset_x))
- dev_warn(&fn->dev,
- "Failed to create debugfs offset_y for sensor %d.\n",
- sensor->sensor_index);
-
- if (!debugfs_create_bool("swap", RMI_RW_ATTR, sensor_root,
- &sensor->axis_align.swap_axes))
- dev_warn(&fn->dev,
- "Failed to create debugfs swap for sensor %d.\n",
- sensor->sensor_index);
-}
-
-static void rmi_f11_setup_debugfs(struct rmi_function *fn)
-{
- struct f11_data *f11 = fn->data;
-
- if (fn->debugfs_root)
- if (!debugfs_create_u16("rezero_wait", RMI_RW_ATTR,
- fn->debugfs_root,
- &f11->rezero_wait_ms))
- dev_warn(&fn->dev,
- "Failed to create debugfs rezero_wait.\n");
-}
-#else
-static inline void rmi_f11_setup_sensor_debugfs(struct f11_2d_sensor *sensor)
-{
-}
-static inline void rmi_f11_setup_debugfs(struct rmi_function *fn)
-{
-}
-#endif
-/* End adding debugfs */
-
/** F11_INACCURATE state is overloaded to indicate pen present. */
#define F11_PEN F11_INACCURATE
@@ -1886,12 +1714,8 @@ static int rmi_f11_initialize(struct rmi_function *fn)
dev_warn(&fn->dev, "Failed to write to delta_y_threshold %d. Code: %d.\n",
i, rc);
}
-
- rmi_f11_setup_sensor_debugfs(sensor);
}
- rmi_f11_setup_debugfs(fn);
-
mutex_init(&f11->dev_controls_mutex);
return 0;
}
@@ -2112,18 +1936,11 @@ static int rmi_f11_probe(struct rmi_function *fn)
if (error)
return error;
- error = sysfs_create_group(&fn->dev.kobj, &rmi_f11_attr_group);
- if (error)
- return error;
-
return 0;
}
static void rmi_f11_remove(struct rmi_function *fn)
{
- debugfs_remove_recursive(fn->debugfs_root);
- sysfs_remove_group(&fn->dev.kobj, &rmi_f11_attr_group);
-
rmi_f11_free_devices(fn);
}
diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index f3bef04..62351c4 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -8,7 +8,6 @@
*/
#include <linux/kernel.h>
-#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
@@ -61,8 +60,9 @@ static int setup_debugfs(struct rmi_device *rmi_dev, struct rmi_i2c_data *data)
if (!rmi_dev->debugfs_root)
return -ENODEV;
- data->debugfs_comms = debugfs_create_bool("comms_debug", RMI_RW_ATTR,
- rmi_dev->debugfs_root, &data->comms_debug);
+ data->debugfs_comms = debugfs_create_bool("comms_debug",
+ (S_IRUGO | S_IWUGO), rmi_dev->debugfs_root,
+ &data->comms_debug);
if (!data->debugfs_comms || IS_ERR(data->debugfs_comms)) {
dev_warn(&rmi_dev->dev,
"Failed to create debugfs comms_debug.\n");
^ permalink raw reply related
* [PATCH] HID: logitech-dj: add HIDRAW dependency in Kconfig
From: Olivier Gay @ 2013-12-02 23:17 UTC (permalink / raw)
To: linux-input
Cc: Jiri Kosina, linux-kernel, Olivier Gay, Nestor Lopez Casado,
Mathieu Meisser
hid-logitech-dj.c driver needs hidraw to work correctly. Without
hidraw, hid-logitech-dj.c fails during probe() and Logitech
Unifying devices HID reports aren't recognized.
Signed-off-by: Olivier Gay <ogay@logitech.com>
Signed-off-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
Signed-off-by: Mathieu Meisser <mmeisser@logitech.com>
---
Hi everyone,
this adds a HIDRAW dependency in Kconfig for hid-logitech-dj.c
driver. The driver uses hidraw and needs it to work correctly.
Without hidraw if a Logitech Unifying device is plugged, the driver
fails during probe() and Logitech Unifying devices HID reports aren't
recognized. This has been the cause of some confusion. Some Linux and
Android distributions had HID_LOGITECH_DJ enabled without HIDRAW and
the Unifying mice and keyboards would simply not work (no cursor
tracking / no keyboard typing).
Best regards,
Olivier
drivers/hid/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 329fbb9..c8a66b9 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -344,6 +344,7 @@ config HID_LOGITECH
config HID_LOGITECH_DJ
tristate "Logitech Unifying receivers full support"
+ depends on HIDRAW
depends on HID_LOGITECH
---help---
Say Y if you want support for Logitech Unifying receivers and devices.
--
1.8.4
^ permalink raw reply related
* Re: [PATCH] hid: add NOGET quirk and device id for Logitech Dual Action gamepads support
From: Jiri Kosina @ 2013-12-02 21:51 UTC (permalink / raw)
To: Zawullon; +Cc: linux-input, linux-kernel
In-Reply-To: <529CCA03.8090602@gmail.com>
On Mon, 2 Dec 2013, Zawullon wrote:
> > Please provide your Signed-off-by: line so that I could apply the patch.
> > Thanks.
>
> Oh, of course. Sorry.
>
> Signed-off-by: Vitaly Katraew <zawullon@gmail.com>
Now applied (with the name above as authorship as well). Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH 1/2] HID: hid-sensor-hub: Add logical min and max
From: Jonathan Cameron @ 2013-12-02 21:07 UTC (permalink / raw)
To: Jonathan Cameron, Jiri Kosina
Cc: Srinivas Pandruvada, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-iio-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <b2e31404-966e-4f1a-a85b-a01fa63064b9-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
On 12/02/13 17:14, Jonathan Cameron wrote:
> Hi Jiri
>
> I tend to push a testing branch to catch any build issues before pushing to the real togreg branch. Normally there are only a few hours on between but sometimes it is a few days as here. I will move these to the fixes-togreg branch - hopefully this evening...
Now applied to the fixes-togreg branch (this one does get pushed out to kernel.org
directly!)
>
> Jiri Kosina <jkosina-AlSwsSmVLrQ@public.gmane.org> wrote:
>> On Sat, 30 Nov 2013, Jonathan Cameron wrote:
>>
>>> On 11/27/13 22:19, Srinivas Pandruvada wrote:
>>>> Exporting logical minimum and maximum of HID fields as part of the
>>>> hid sensor attribute info. This can be used for range checking and
>>>> to calculate enumeration base for NAry fields of HID sensor hub.
>>>>
>>>> Signed-off-by: Srinivas Pandruvada
>> <srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>>> Hi, I would have preffred this being done in two patches, the first
>>> refactoring the function call and the second doing the min and max.
>>>
>>> Anyhow, I'll take it anyway.
>>>
>>> Applied to the togreg branch of iio.git.
>> Where is that? I don't seem to see it in
>>
>> https://git.kernel.org/cgit/linux/kernel/git/jic23/iio.git/log/?h=togreg
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox