"bind" a device to a driver doesn't not work anymore
Subsystems (2)
Hello,
After a suspend, I used to do this (to get the PS2 keyboard working again), and it used to work fine:
echo -n "i8042" > /sys/bus/platform/drivers/i8042/unbind ; sleep 1 ; echo -n "i8042" > /sys/bus/platform/drivers/i8042/bind
Unfortunately since 2.6.32-rc1, the unbind works fine, but the bind returns a "no such device" error now (and the binding is not done). After that, additional unbinds also report the error. I think 2.6.31 worked fine. Any idea what's going wrong?
Thanks,
Eric
Quoted 11 lines · ?ric Piel
Hello,
After a suspend, I used to do this (to get the PS2 keyboard working again), and it used to work fine:
echo -n "i8042" >/sys/bus/platform/drivers/i8042/unbind; sleep 1 ; echo -n "i8042" >/sys/bus/platform/drivers/i8042/bindUnfortunately since 2.6.32-rc1, the unbind works fine, but the bind returns a "no such device" error now (and the binding is not done). After that, additional unbinds also report the error. I think 2.6.31 worked fine. Any idea what's going wrong?
Odd. Any chance you can run 'git bisect' to figure out which patch might have caused it?
thanks,
greg k-h
Quoted 8 lines · Greg KH
Quoted 7 lines · ?ric Piel
Hello,
After a suspend, I used to do this (to get the PS2 keyboard working again), and it used to work fine:
echo -n "i8042" >/sys/bus/platform/drivers/i8042/unbind; sleep 1 ; echo -n "i8042" >/sys/bus/platform/drivers/i8042/bind
Quoted 7 lines
Quoted 4 lines
Unfortunately since 2.6.32-rc1, the unbind works fine, but the bind returns a "no such device" error now (and the binding is not done). After that, additional unbinds also report the error. I think 2.6.31 worked fine. Any idea what's going wrong?
Odd. Any chance you can run 'git bisect' to figure out which patch might have caused it?
I8042 has been converted to use platform_driver_probe() - we are creating platform device and platform driver together, there is no chance that some other device might be driven by i8042 driver.
Eric, do you still need to fiddle with i8042 to get your keyboard working with 2.6.32-rc3? We need to make sure that resube works without users needing to mess with bind/unbind.
Signature · 1 line
Dmitry
Op 12-10-09 06:35, Dmitry Torokhov schreef:
Quoted 13 lines · Greg KH
Quoted 12 lines · ?ric Piel
Quoted 11 lines
Hello,
After a suspend, I used to do this (to get the PS2 keyboard working again), and it used to work fine:
echo -n "i8042" >/sys/bus/platform/drivers/i8042/unbind; sleep 1 ; echo -n "i8042" >/sys/bus/platform/drivers/i8042/bindUnfortunately since 2.6.32-rc1, the unbind works fine, but the bind returns a "no such device" error now (and the binding is not done). After that, additional unbinds also report the error. I think 2.6.31 worked fine. Any idea what's going wrong?
Quoted 6 lines
Quoted 2 lines
Odd. Any chance you can run 'git bisect' to figure out which patch might have caused it?
I8042 has been converted to use
platform_driver_probe()- we are creating platform device and platform driver together, there is no chance that some other device might be driven by i8042 driver.
I haven't finished bisecting, but indeed, the problem seemed to converge toward this patch.
Quoted 3 lines
Eric, do you still need to fiddle with i8042 to get your keyboard working with 2.6.32-rc3? We need to make sure that resube works without users needing to mess with bind/unbind.
Yes, the keyboard doesn't work after the first resume from ram (the later resumes do work). I haven't tried any special option to the i8042 driver. This is on a HP 2510, in 64 bits.
Indeed, it would be great to fix this root problem! Is there any bug report opened to work on this?
However, currently the first problem is that unbind works, while bind doesn't. Which means anyone doing an unbind will have keyboard and mouse lost until the next reboot. That's rather bad because it has been recommended for a long time to have this kind of script at resume:
http://intertrusion.com/files/hp-s2ram.patch
http://en.opensuse.org/Pm-utils
So at least, unbind should fail as well as bind.
Eric
Quoted 34 lines · Éric Piel
Op 12-10-09 06:35, Dmitry Torokhov schreef:
Quoted 13 lines · Greg KH
Quoted 12 lines · ?ric Piel
Quoted 11 lines
Hello,
After a suspend, I used to do this (to get the PS2 keyboard working again), and it used to work fine:
echo -n "i8042" >/sys/bus/platform/drivers/i8042/unbind; sleep 1 ; echo -n "i8042" >/sys/bus/platform/drivers/i8042/bindUnfortunately since 2.6.32-rc1, the unbind works fine, but the bind returns a "no such device" error now (and the binding is not done). After that, additional unbinds also report the error. I think 2.6.31 worked fine. Any idea what's going wrong?
Quoted 6 lines
Quoted 2 lines
Odd. Any chance you can run 'git bisect' to figure out which patch might have caused it?
I8042 has been converted to use
platform_driver_probe()- we are creating platform device and platform driver together, there is no chance that some other device might be driven by i8042 driver.I haven't finished bisecting, but indeed, the problem seemed to converge toward this patch.
Quoted 3 lines
Eric, do you still need to fiddle with i8042 to get your keyboard working with 2.6.32-rc3? We need to make sure that resube works without users needing to mess with bind/unbind.
Yes, the keyboard doesn't work after the first resume from ram (the later resumes do work). I haven't tried any special option to the i8042 driver. This is on a HP 2510, in 64 bits.
Indeed, it would be great to fix this root problem! Is there any bug report opened to work on this?
Quoted 8 lines
However, currently the first problem is that unbind works, while bind doesn't. Which means anyone doing an unbind will have keyboard and mouse lost until the next reboot. That's rather bad because it has been recommended for a long time to have this kind of script at resume:
http://intertrusion.com/files/hp-s2ram.patch
http://en.opensuse.org/Pm-utilsSo at least, unbind should fail as well as bind.
Ah, I bet I know why bind fails... Yeah, the i8042_platform_device is never freed up in the i8042_remove() function in drivers/input/serio/i8042.c, so when you try to register it again, it fails.
Dmitry, care to fix this up? Should be pretty simple.
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 42 lines · Greg KH
Quoted 41 lines · Éric Piel
Op 12-10-09 06:35, Dmitry Torokhov schreef:
Quoted 13 lines · Greg KH
Quoted 12 lines · ?ric Piel
Quoted 11 lines
Hello,
After a suspend, I used to do this (to get the PS2 keyboard working again), and it used to work fine:
echo -n "i8042" >/sys/bus/platform/drivers/i8042/unbind; sleep 1 ; echo -n "i8042" >/sys/bus/platform/drivers/i8042/bindUnfortunately since 2.6.32-rc1, the unbind works fine, but the bind returns a "no such device" error now (and the binding is not done). After that, additional unbinds also report the error. I think 2.6.31 worked fine. Any idea what's going wrong?
Quoted 6 lines
Quoted 2 lines
Odd. Any chance you can run 'git bisect' to figure out which patch might have caused it?
I8042 has been converted to use
platform_driver_probe()- we are creating platform device and platform driver together, there is no chance that some other device might be driven by i8042 driver.I haven't finished bisecting, but indeed, the problem seemed to converge toward this patch.
Quoted 3 lines
Eric, do you still need to fiddle with i8042 to get your keyboard working with 2.6.32-rc3? We need to make sure that resube works without users needing to mess with bind/unbind.
Yes, the keyboard doesn't work after the first resume from ram (the later resumes do work). I haven't tried any special option to the i8042 driver. This is on a HP 2510, in 64 bits.
Indeed, it would be great to fix this root problem! Is there any bug report opened to work on this?
However, currently the first problem is that unbind works, while bind doesn't. Which means anyone doing an unbind will have keyboard and mouse lost until the next reboot. That's rather bad because it has been recommended for a long time to have this kind of script at resume:
http://intertrusion.com/files/hp-s2ram.patch
http://en.opensuse.org/Pm-utils
Quoted 7 lines
Quoted 1 line
So at least, unbind should fail as well as bind.
Ah, I bet I know why bind fails... Yeah, the
i8042_platform_deviceis never freed up in thei8042_remove()function indrivers/input/serio/i8042.c, so when you try to register it again, it fails.
Huh? Platform device and driver are created in i8042_init() and removed in i8042_exit(); i8042_remove() is a remove() method of the platform driver so it never should be freeing the platform device.
The issue is that with platform drivers using i8042_driver_probe() the probe frunction is discarded afterwards so the driver can't be bound to anything after initialization has been completed; however unbinding through 'unbind' attribute still works (once). You may recall a thread with me and David arguing about it a couple of weeks ago...
Signature · 5 lines
Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 24 lines · Éric Piel
Op 12-10-09 06:35, Dmitry Torokhov schreef:
Quoted 13 lines · Greg KH
Quoted 12 lines · ?ric Piel
Quoted 11 lines
Hello,
After a suspend, I used to do this (to get the PS2 keyboard working again), and it used to work fine:
echo -n "i8042" >/sys/bus/platform/drivers/i8042/unbind; sleep 1 ; echo -n "i8042" >/sys/bus/platform/drivers/i8042/bindUnfortunately since 2.6.32-rc1, the unbind works fine, but the bind returns a "no such device" error now (and the binding is not done). After that, additional unbinds also report the error. I think 2.6.31 worked fine. Any idea what's going wrong?
Quoted 6 lines
Quoted 2 lines
Odd. Any chance you can run 'git bisect' to figure out which patch might have caused it?
I8042 has been converted to use
platform_driver_probe()- we are creating platform device and platform driver together, there is no chance that some other device might be driven by i8042 driver.I haven't finished bisecting, but indeed, the problem seemed to converge toward this patch.
Quoted 6 lines
Quoted 3 lines
Eric, do you still need to fiddle with i8042 to get your keyboard working with 2.6.32-rc3? We need to make sure that resube works without users needing to mess with bind/unbind.
Yes, the keyboard doesn't work after the first resume from ram (the later resumes do work). I haven't tried any special option to the i8042 driver. This is on a HP 2510, in 64 bits.
Could you please try and let me know if unloading at suspend and reloading after resume atkbd and/or psmouse drivers and leaving i8042 alone "fixes" the issue?
Quoted 10 lines
Indeed, it would be great to fix this root problem! Is there any bug report opened to work on this?
However, currently the first problem is that unbind works, while bind doesn't. Which means anyone doing an unbind will have keyboard and mouse lost until the next reboot. That's rather bad because it has been recommended for a long time to have this kind of script at resume:
http://intertrusion.com/files/hp-s2ram.patch
http://en.opensuse.org/Pm-utils
*ahem* putting it sonewgere on the web does not really make it "recommended" ;)
Quoted 3 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with platform_driver_probe().
Signature · 1 line
Dmitry
Op 12-10-09 17:48, Dmitry Torokhov schreef:
Quoted 12 lines · Éric Piel
Quoted 6 lines
Quoted 3 lines
Eric, do you still need to fiddle with i8042 to get your keyboard working with 2.6.32-rc3? We need to make sure that resube works without users needing to mess with bind/unbind.
Yes, the keyboard doesn't work after the first resume from ram (the later resumes do work). I haven't tried any special option to the i8042 driver. This is on a HP 2510, in 64 bits.
Could you please try and let me know if unloading at suspend and reloading after resume atkbd and/or psmouse drivers and leaving i8042 alone "fixes" the issue?
I've just tried adding i8042.reset to the boot command line, and it doesn't help (still no keyboard after resume). That's actually a bit surprising because I saw on some forum that in general it helped for the HP laptops. Is there a way to be sure the command was understood by the driver? I see nothing confirming in dmesg.
My atkbd and psmouse drivers were built-in, so I'm currently recompiling the kernel with them as module and will let you know tomorrow.
See you,
Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().
No, I do not see why that should not be allowed.
thanks,
greg k-h
Quoted 51 lines · Dmitry Torokhov
Quoted 42 lines · Greg KH
Quoted 41 lines · Éric Piel
Op 12-10-09 06:35, Dmitry Torokhov schreef:
Quoted 13 lines · Greg KH
Quoted 12 lines · ?ric Piel
Quoted 11 lines
Hello,
After a suspend, I used to do this (to get the PS2 keyboard working again), and it used to work fine:
echo -n "i8042" >/sys/bus/platform/drivers/i8042/unbind; sleep 1 ; echo -n "i8042" >/sys/bus/platform/drivers/i8042/bindUnfortunately since 2.6.32-rc1, the unbind works fine, but the bind returns a "no such device" error now (and the binding is not done). After that, additional unbinds also report the error. I think 2.6.31 worked fine. Any idea what's going wrong?
Quoted 6 lines
Quoted 2 lines
Odd. Any chance you can run 'git bisect' to figure out which patch might have caused it?
I8042 has been converted to use
platform_driver_probe()- we are creating platform device and platform driver together, there is no chance that some other device might be driven by i8042 driver.I haven't finished bisecting, but indeed, the problem seemed to converge toward this patch.
Quoted 3 lines
Eric, do you still need to fiddle with i8042 to get your keyboard working with 2.6.32-rc3? We need to make sure that resube works without users needing to mess with bind/unbind.
Yes, the keyboard doesn't work after the first resume from ram (the later resumes do work). I haven't tried any special option to the i8042 driver. This is on a HP 2510, in 64 bits.
Indeed, it would be great to fix this root problem! Is there any bug report opened to work on this?
However, currently the first problem is that unbind works, while bind doesn't. Which means anyone doing an unbind will have keyboard and mouse lost until the next reboot. That's rather bad because it has been recommended for a long time to have this kind of script at resume:
http://intertrusion.com/files/hp-s2ram.patch
http://en.opensuse.org/Pm-utilsQuoted 7 lines
Quoted 1 line
So at least, unbind should fail as well as bind.
Ah, I bet I know why bind fails... Yeah, the
i8042_platform_deviceis never freed up in thei8042_remove()function indrivers/input/serio/i8042.c, so when you try to register it again, it fails.
Quoted 3 lines
Huh? Platform device and driver are created in
i8042_init()and removed ini8042_exit();i8042_remove()is aremove()method of the platform driver so it never should be freeing the platform device.
Ah, but you do not have the ability to allow a bind to ever happen again. I guess that's fine if you don't want that to happen. And for platform devices, it's kind of difficult now that I think about it some more.
Quoted 5 lines
The issue is that with platform drivers using
i8042_driver_probe()the probe frunction is discarded afterwards so the driver can't be bound to anything after initialization has been completed; however unbinding through 'unbind' attribute still works (once). You may recall a thread with me and David arguing about it a couple of weeks ago...
Yeah, I remember that...
At least we now know the problem. Just rmmod and insmod the module to unbind/bind and everyone will be happy :)
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only __devinit but __devexit sections when driver is built in which would make ebedded people happy[^Hier].
Signature · 1 line
Dmitry
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().
Quoted 8 lines
Quoted 2 lines
No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].
Yeah, good point.
Does anyone do bind/unbind with platform devices today?
If not, a patch changing this would be welcome.
thanks,
greg k-h
Quoted 19 lines · Greg KH
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().Quoted 8 lines
Quoted 2 lines
No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].
Quoted 4 lines
Yeah, good point.
Does anyone do bind/unbind with platform devices today?
Greg, meet Eric ;)
Although I'd really want to fix the resume issue so it works out of the box without needing to bind/unbind or reload i8042.
Signature · 1 line
Dmitry
Quoted 20 lines · Dmitry Torokhov
Quoted 19 lines · Greg KH
Quoted 17 lines · Dmitry Torokhov
Quoted 10 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].
Quoted 6 lines
Quoted 4 lines
Yeah, good point.
Does anyone do bind/unbind with platform devices today?
Greg, meet Eric ;)
Heh, yes, I mean for a "useful" thing :)
Eric is trying to do this to resolve a bug in the driver, not a thing that is "normally" done for platform devices.
Quoted 2 lines
Although I'd really want to fix the resume issue so it works out of the box without needing to bind/unbind or reload i8042.
I agree.
thanks,
greg k-h
Quoted 19 lines · Greg KH
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().Quoted 8 lines
Quoted 2 lines
No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].
Quoted 6 lines
Yeah, good point.
Does anyone do bind/unbind with platform devices today?
If not, a patch changing this would be welcome.
How about this one?
Signature · 20 lines
Dmitry Driver core: allow certain drivers prohibit bind/unbind via sysfs From: Dmitry Torokhov <[email protected]> Platform drivers registered via platform_driver_probe() can be bound to devices only once, upon registration, because discard their probe() routines to save memory. Unbinding the driver through sysfs 'unbind' leaves the device stranded and confuses users so let's not create bind and unbind attributes for such drivers. Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/base/bus.c | 17 +++++++++++------ drivers/base/platform.c | 6 +++++- include/linux/device.h | 4 +++- 3 files changed, 19 insertions(+), 8 deletions(-)
drivers/base/bus.c +11 -6
@@ -689,15 +689,19 @@ int bus_add_driver(struct device_driver *drv)printk (KERN_ERR "%s: driver_add_attrs(%s) failed\n" , __func__, drv->name); } - error =add_bind_files (drv); -if (error) { -/* Ditto */ -printk (KERN_ERR "%s: add_bind_files(%s) failed\n" , - __func__, drv->name); + +if (!drv->suppress_bind_attrs) { + error =add_bind_files (drv); +if (error) { +/* Ditto */ +printk (KERN_ERR "%s: add_bind_files(%s) failed\n" , + __func__, drv->name); + } }kobject_uevent (&priv->kobj,KOBJ_ADD );return 0 ; + out_unregister:kfree (drv->p); drv->p =NULL ;
@@ -720,7 +724,8 @@ void bus_remove_driver(struct device_driver *drv)if (!drv->bus)return ; -remove_bind_files (drv); +if (!drv->suppress_bind_attrs) +remove_bind_files (drv);driver_remove_attrs (drv->bus, drv);driver_remove_file (drv, &driver_attr_uevent);klist_remove (&drv->p->knode_bus);
drivers/base/platform.c +5 -1
@@ -521,11 +521,15 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv, {int retval, code; +/* make sure driver won't have bind/unbind attributes */ + drv->driver.suppress_bind_attrs = true; +/* temporary section violation during probe() */ drv->probe = probe; retval = code =platform_driver_register (drv); -/* Fixup that section violation, being paranoid about code scanning +/* +* Fixup that section violation, being paranoid about code scanning * the list of drivers in order to probe new devices. Check to see * if the probe was successful, and make sure any forced probes of * new devices fail.
include/linux/device.h +3 -1
@@ -124,7 +124,9 @@ struct device_driver {struct bus_type *bus;struct module *owner; -const char *mod_name;/* used for built-in modules */ +const char *mod_name;/* used for built-in modules */ + +bool suppress_bind_attrs;/* disables bind/unbind via sysfs */ int (*probe) (struct device *dev);int (*remove) (struct device *dev);
Op 12-10-09 17:48, Dmitry Torokhov schreef:
Quoted 12 lines · Éric Piel
Quoted 6 lines
Quoted 3 lines
Eric, do you still need to fiddle with i8042 to get your keyboard working with 2.6.32-rc3? We need to make sure that resube works without users needing to mess with bind/unbind.
Yes, the keyboard doesn't work after the first resume from ram (the later resumes do work). I haven't tried any special option to the i8042 driver. This is on a HP 2510, in 64 bits.
Could you please try and let me know if unloading at suspend and reloading after resume atkbd and/or psmouse drivers and leaving i8042 alone "fixes" the issue?
Unloading the modules before suspend and reloading them after works around the issue, indeed.
Eric
Quoted 20 lines · Dmitry Torokhov
Quoted 19 lines · Greg KH
Quoted 17 lines · Dmitry Torokhov
Quoted 10 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].
Quoted 9 lines
Quoted 6 lines
Yeah, good point.
Does anyone do bind/unbind with platform devices today?
If not, a patch changing this would be welcome.
How about this one?
*ping* We need to resolve this, otherwise everyone who likes to rebind i8042 in couse of STR/STD will be in trouble.
Quoted 98 lines
Signature · 20 lines
Dmitry Driver core: allow certain drivers prohibit bind/unbind via sysfs From: Dmitry Torokhov <[email protected]> Platform drivers registered via platform_driver_probe() can be bound to devices only once, upon registration, because discard their probe() routines to save memory. Unbinding the driver through sysfs 'unbind' leaves the device stranded and confuses users so let's not create bind and unbind attributes for such drivers. Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/base/bus.c | 17 +++++++++++------ drivers/base/platform.c | 6 +++++- include/linux/device.h | 4 +++- 3 files changed, 19 insertions(+), 8 deletions(-)drivers/base/bus.c +11
-6@@ -689,15 +689,19 @@ int bus_add_driver(struct device_driver *drv)printk (KERN_ERR "%s: driver_add_attrs(%s) failed\n" , __func__, drv->name); } - error =add_bind_files (drv); -if (error) { -/* Ditto */ -printk (KERN_ERR "%s: add_bind_files(%s) failed\n" , - __func__, drv->name); + +if (!drv->suppress_bind_attrs) { + error =add_bind_files (drv); +if (error) { +/* Ditto */ +printk (KERN_ERR "%s: add_bind_files(%s) failed\n" , + __func__, drv->name); + } }kobject_uevent (&priv->kobj,KOBJ_ADD );return 0 ; + out_unregister:kfree (drv->p); drv->p =NULL ;@@ -720,7 +724,8 @@ void bus_remove_driver(struct device_driver *drv)if (!drv->bus)return ; -remove_bind_files (drv); +if (!drv->suppress_bind_attrs) +remove_bind_files (drv);driver_remove_attrs (drv->bus, drv);driver_remove_file (drv, &driver_attr_uevent);klist_remove (&drv->p->knode_bus);drivers/base/platform.c +5
-1@@ -521,11 +521,15 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv, {int retval, code; +/* make sure driver won't have bind/unbind attributes */ + drv->driver.suppress_bind_attrs = true; +/* temporary section violation during probe() */ drv->probe = probe; retval = code =platform_driver_register (drv); -/* Fixup that section violation, being paranoid about code scanning +/* +* Fixup that section violation, being paranoid about code scanning * the list of drivers in order to probe new devices. Check to see * if the probe was successful, and make sure any forced probes of * new devices fail. include/linux/device.h +3
-1@@ -124,7 +124,9 @@ struct device_driver {struct bus_type *bus;struct module *owner; -const char *mod_name;/* used for built-in modules */ +const char *mod_name;/* used for built-in modules */ + +bool suppress_bind_attrs;/* disables bind/unbind via sysfs */ int (*probe) (struct device *dev);int (*remove) (struct device *dev);
Signature · 1 line
Dmitry
Quoted 25 lines · Dmitry Torokhov
Quoted 24 lines · Dmitry Torokhov
Quoted 23 lines · Greg KH
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().Quoted 8 lines
Quoted 2 lines
No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].Yeah, good point.
Does anyone do bind/unbind with platform devices today?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
If not, a patch changing this would be welcome.
How about this one?
*ping* We need to resolve this, otherwise everyone who likes to rebind i8042 in couse of STR/STD will be in trouble.
Sorry, am in Tokyo right now.
I like this patch, and will queue it up, but it's too late for .32, it will have to wait for .33.
I'll hope to get my patch queue flushed out after I return in about 10 days.
thanks,
greg k-h
Quoted 32 lines · Greg KH
Quoted 31 lines · Dmitry Torokhov
Quoted 29 lines · Dmitry Torokhov
Quoted 19 lines · Greg KH
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().Quoted 8 lines
Quoted 2 lines
No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].Quoted 6 lines
Yeah, good point.
Does anyone do bind/unbind with platform devices today?
If not, a patch changing this would be welcome.
How about this one?
Quoted 8 lines
Quoted 2 lines
*ping* We need to resolve this, otherwise everyone who likes to rebind i8042 in couse of STR/STD will be in trouble.
Sorry, am in Tokyo right now.
I like this patch, and will queue it up, but it's too late for .32, it will have to wait for .33.
Greg,
I hope you will reconsider. The patch is extremely small but without it I am afraid many people whose distributions blindly rebind i8042 on suspend/resume will lose their keyboards and mice now that i8042 uses platform_driver_probe()...
Thanks.
Signature · 1 line
Dmitry
Quoted 42 lines · Dmitry Torokhov
Quoted 32 lines · Greg KH
Quoted 31 lines · Dmitry Torokhov
Quoted 29 lines · Dmitry Torokhov
Quoted 19 lines · Greg KH
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().Quoted 8 lines
Quoted 2 lines
No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].Quoted 6 lines
Yeah, good point.
Does anyone do bind/unbind with platform devices today?
If not, a patch changing this would be welcome.
How about this one?
Quoted 8 lines
Quoted 2 lines
*ping* We need to resolve this, otherwise everyone who likes to rebind i8042 in couse of STR/STD will be in trouble.
Sorry, am in Tokyo right now.
I like this patch, and will queue it up, but it's too late for .32, it will have to wait for .33.
Quoted 6 lines
Greg,
I hope you will reconsider. The patch is extremely small but without it I am afraid many people whose distributions blindly rebind i8042 on suspend/resume will lose their keyboards and mice now that i8042 uses
platform_driver_probe()...
What distros do something like that automatically? And this patch will not solve that problem, just forbid it from happening, right?
thanks,
greg k-h
Quoted 43 lines · Greg KH
Quoted 42 lines · Dmitry Torokhov
Quoted 40 lines · Greg KH
Quoted 25 lines · Dmitry Torokhov
Quoted 24 lines · Dmitry Torokhov
Quoted 23 lines · Greg KH
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().Quoted 8 lines
Quoted 2 lines
No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].Yeah, good point.
Does anyone do bind/unbind with platform devices today?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
If not, a patch changing this would be welcome.
How about this one?
*ping* We need to resolve this, otherwise everyone who likes to rebind i8042 in couse of STR/STD will be in trouble.
Sorry, am in Tokyo right now.
I like this patch, and will queue it up, but it's too late for .32, it will have to wait for .33.
Quoted 8 lines
Quoted 6 lines
Greg,
I hope you will reconsider. The patch is extremely small but without it I am afraid many people whose distributions blindly rebind i8042 on suspend/resume will lose their keyboards and mice now that i8042 uses
platform_driver_probe()...What distros do something like that automatically?
It looks SUSE recommends to do so in one of the Wikis.. There certainly lots of recommendations to do so in case of keyboard resume troubles all over the forums (Ubunto, Gentoo, other random ones).
Quoted 3 lines
And this patch will
not solve that problem, just forbid it from happening, right?
It will prevent unbind from happening so that users who have suspend and resume working properly but who have bind/unbind in their suspend/resume scripts regardless will not run into trouble.
This still leaves users whose suspend/resume don't work by default but I would rather fix their boxes properly instead of relying on that workaround.
Signature · 1 line
Dmitry
Quoted 61 lines · Dmitry Torokhov
Quoted 43 lines · Greg KH
Quoted 42 lines · Dmitry Torokhov
Quoted 40 lines · Greg KH
Quoted 25 lines · Dmitry Torokhov
Quoted 24 lines · Dmitry Torokhov
Quoted 23 lines · Greg KH
Quoted 9 lines · Dmitry Torokhov
Quoted 8 lines · Greg KH
Quoted 6 lines · Dmitry Torokhov
Quoted 2 lines
So at least, unbind should fail as well as bind.
That would be Greg's domain s it is driver core decision whether to allow unbinding platform devices registered with
platform_driver_probe().Quoted 8 lines
Quoted 2 lines
No, I do not see why that should not be allowed.
Because once you did unbind the device you are stuck (unless the driver is compiled as a module, but then you could just unload the module instead of unbinding). Disallowing unbind would allow discarding not only
__devinitbut__devexitsections when driver is built in which would make ebedded people happy[^Hier].Yeah, good point.
Does anyone do bind/unbind with platform devices today?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
If not, a patch changing this would be welcome.
How about this one?
*ping* We need to resolve this, otherwise everyone who likes to rebind i8042 in couse of STR/STD will be in trouble.
Sorry, am in Tokyo right now.
I like this patch, and will queue it up, but it's too late for .32, it will have to wait for .33.
Quoted 8 lines
Quoted 6 lines
Greg,
I hope you will reconsider. The patch is extremely small but without it I am afraid many people whose distributions blindly rebind i8042 on suspend/resume will lose their keyboards and mice now that i8042 uses
platform_driver_probe()...What distros do something like that automatically?
It looks SUSE recommends to do so in one of the Wikis.. There certainly lots of recommendations to do so in case of keyboard resume troubles all over the forums (Ubunto, Gentoo, other random ones).
Quoted 3 lines
And this patch will
not solve that problem, just forbid it from happening, right?
Quoted 7 lines
It will prevent unbind from happening so that users who have suspend and resume working properly but who have bind/unbind in their suspend/resume scripts regardless will not run into trouble.
This still leaves users whose suspend/resume don't work by default but I would rather fix their boxes properly instead of relying on that workaround.
Ok, fair enough, I'll queue it up for .32.
thanks,
greg k-h
Quoted 6 lines · Greg KH
Quoted 5 lines · Dmitry Torokhov
It will prevent unbind from happening so that users who have suspend and resume working properly but who have bind/unbind in their suspend/resume scripts regardless will not run into trouble.
Quoted 6 lines
Quoted 3 lines
This still leaves users whose suspend/resume don't work by default but I would rather fix their boxes properly instead of relying on that workaround.
Ok, fair enough, I'll queue it up for .32.
Thanks Greg, much appreciated.
Signature · 1 line
Dmitry