diff options
4 files changed, 537 insertions, 0 deletions
diff --git a/driver-core/sysfs-allow-boot-time-switching-between-deprecated-and-modern-sysfs-layout.patch b/driver-core/sysfs-allow-boot-time-switching-between-deprecated-and-modern-sysfs-layout.patch new file mode 100644 index 00000000000000..dd71b73eb18ab4 --- /dev/null +++ b/driver-core/sysfs-allow-boot-time-switching-between-deprecated-and-modern-sysfs-layout.patch @@ -0,0 +1,260 @@ +From andi@firstfloor.org Tue Sep 21 13:18:12 2010 +From: Andi Kleen <andi@firstfloor.org> +To: greg@kroah.com +Cc: linux-kernel@vger.kernel.org, + Andi Kleen <ak@linux.intel.com>, + axboe@kernel.dk +Subject: SYSFS: Allow boot time switching between deprecated and modern sysfs layout +Date: Wed, 8 Sep 2010 16:54:17 +0200 +Message-Id: <1283957657-17740-1-git-send-email-andi@firstfloor.org> + +From: Andi Kleen <ak@linux.intel.com> + +I have some systems which need legacy sysfs due to old udev versions, +and it's a big hazzle to compile separate kernels for them. + +This patch turns CONFIG_SYSFS_DEPRECATED into a run time option +that can be switched on/off the kernel command line. This way +the same binary can be used in both cases with just a option +on the command line. + +The old CONFIG_SYSFS_DEPRECATED_V2 option is still there to set +the default. I kept the weird name to not break existing +config files. + +Also the compat code can be still completely disabled by undefining +CONFIG_SYSFS_DEPRECATED_SWITCH -- just the optimizer takes +care of this now instead of lots of ifdefs. This makes the code +look nicer. + +v2: This is an updated version on top of Kay's patch to only +handle the block devices. I tested it on my old systems +and that seems to work. + +Cc: axboe@kernel.dk +Signed-off-by: Andi Kleen <ak@linux.intel.com> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + Documentation/kernel-parameters.txt | 9 +++++++++ + block/genhd.c | 7 ++----- + drivers/base/class.c | 4 ++-- + drivers/base/core.c | 26 +++++++++++++++++--------- + fs/partitions/check.c | 19 +++++++++---------- + include/linux/device.h | 7 +++++++ + init/Kconfig | 26 ++++++++++++++++++++++---- + 7 files changed, 68 insertions(+), 30 deletions(-) + +--- a/Documentation/kernel-parameters.txt ++++ b/Documentation/kernel-parameters.txt +@@ -2365,6 +2365,15 @@ and is between 256 and 4096 characters. + + switches= [HW,M68k] + ++ sysfs.deprecated=0|1 [KNL] ++ Enable/disable old style sysfs layout for old udev ++ on older distributions. When this option is enabled ++ very new udev will not work anymore. When this option ++ is disabled (or CONFIG_SYSFS_DEPRECATED not compiled) ++ in older udev will not work anymore. ++ Default depends on CONFIG_SYSFS_DEPRECATED_V2 set in ++ the kernel configuration. ++ + sysrq_always_enabled + [KNL] + Ignore sysrq setting - this boot parameter will +--- a/block/genhd.c ++++ b/block/genhd.c +@@ -22,9 +22,7 @@ + #include "blk.h" + + static DEFINE_MUTEX(block_class_lock); +-#ifndef CONFIG_SYSFS_DEPRECATED + struct kobject *block_depr; +-#endif + + /* for extended dynamic devt allocation, currently only one major is used */ + #define MAX_EXT_DEVT (1 << MINORBITS) +@@ -803,10 +801,9 @@ static int __init genhd_device_init(void + + register_blkdev(BLOCK_EXT_MAJOR, "blkext"); + +-#ifndef CONFIG_SYSFS_DEPRECATED + /* create top-level block dir */ +- block_depr = kobject_create_and_add("block", NULL); +-#endif ++ if (!sysfs_deprecated) ++ block_depr = kobject_create_and_add("block", NULL); + return 0; + } + +--- a/drivers/base/class.c ++++ b/drivers/base/class.c +@@ -184,9 +184,9 @@ int __class_register(struct class *cls, + if (!cls->dev_kobj) + cls->dev_kobj = sysfs_dev_char_kobj; + +-#if defined(CONFIG_SYSFS_DEPRECATED) && defined(CONFIG_BLOCK) ++#if defined(CONFIG_BLOCK) + /* let the block class directory show up in the root of sysfs */ +- if (cls != &block_class) ++ if (!sysfs_deprecated || cls != &block_class) + cp->class_subsys.kobj.kset = class_kset; + #else + cp->class_subsys.kobj.kset = class_kset; +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -26,6 +26,19 @@ + #include "base.h" + #include "power/power.h" + ++#ifdef CONFIG_SYSFS_DEPRECATED ++#ifdef CONFIG_SYSFS_DEPRECATED_V2 ++long sysfs_deprecated = 1; ++#else ++long sysfs_deprecated = 0; ++#endif ++static __init int sysfs_deprecated_setup(char *arg) ++{ ++ return strict_strtol(arg, 10, &sysfs_deprecated); ++} ++early_param("sysfs.deprecated", sysfs_deprecated_setup); ++#endif ++ + int (*platform_notify)(struct device *dev) = NULL; + int (*platform_notify_remove)(struct device *dev) = NULL; + static struct kobject *dev_kobj; +@@ -617,14 +630,13 @@ static struct kobject *get_device_parent + struct kobject *parent_kobj; + struct kobject *k; + +-#ifdef CONFIG_SYSFS_DEPRECATED + /* block disks show up in /sys/block */ +- if (dev->class == &block_class) { ++ if (sysfs_deprecated && dev->class == &block_class) { + if (parent && parent->class == &block_class) + return &parent->kobj; + return &block_class.p->class_subsys.kobj; + } +-#endif ++ + /* + * If we have no parent, we live in "virtual". + * Class-devices with a non class-device as parent, live +@@ -707,11 +719,9 @@ static int device_add_class_symlinks(str + goto out_subsys; + } + +-#ifdef CONFIG_SYSFS_DEPRECATED + /* /sys/block has directories and does not need symlinks */ +- if (dev->class == &block_class) ++ if (sysfs_deprecated && dev->class == &block_class) + return 0; +-#endif + + /* link in the class directory pointing to the device */ + error = sysfs_create_link(&dev->class->p->class_subsys.kobj, +@@ -738,10 +748,8 @@ static void device_remove_class_symlinks + if (dev->parent && device_is_not_partition(dev)) + sysfs_remove_link(&dev->kobj, "device"); + sysfs_remove_link(&dev->kobj, "subsystem"); +-#ifdef CONFIG_SYSFS_DEPRECATED +- if (dev->class == &block_class) ++ if (sysfs_deprecated && dev->class == &block_class) + return; +-#endif + sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev)); + } + +--- a/fs/partitions/check.c ++++ b/fs/partitions/check.c +@@ -513,14 +513,14 @@ void register_disk(struct gendisk *disk) + + if (device_add(ddev)) + return; +-#ifndef CONFIG_SYSFS_DEPRECATED +- err = sysfs_create_link(block_depr, &ddev->kobj, +- kobject_name(&ddev->kobj)); +- if (err) { +- device_del(ddev); +- return; ++ if (!sysfs_deprecated) { ++ err = sysfs_create_link(block_depr, &ddev->kobj, ++ kobject_name(&ddev->kobj)); ++ if (err) { ++ device_del(ddev); ++ return; ++ } + } +-#endif + disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); + disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); + +@@ -737,8 +737,7 @@ void del_gendisk(struct gendisk *disk) + kobject_put(disk->part0.holder_dir); + kobject_put(disk->slave_dir); + disk->driverfs_dev = NULL; +-#ifndef CONFIG_SYSFS_DEPRECATED +- sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); +-#endif ++ if (!sysfs_deprecated) ++ sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); + device_del(disk_to_dev(disk)); + } +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -751,4 +751,11 @@ do { \ + MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) + #define MODULE_ALIAS_CHARDEV_MAJOR(major) \ + MODULE_ALIAS("char-major-" __stringify(major) "-*") ++ ++#ifdef CONFIG_SYSFS_DEPRECATED ++extern long sysfs_deprecated; ++#else ++#define sysfs_deprecated 0 ++#endif ++ + #endif /* _DEVICE_H_ */ +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -660,8 +660,12 @@ config SYSFS_DEPRECATED + depends on SYSFS + default n + help +- This option switches the layout of the "block" class devices, to not +- show up in /sys/class/block/, but only in /sys/block/. ++ This option adds code that switches the layout of the "block" class ++ devices, to not show up in /sys/class/block/, but only in ++ /sys/block/. ++ ++ This switch is only active when the sysfs.deprecated=1 boot option is ++ passed or the SYSFS_DEPRECATED_V2 option is set. + + This option allows new kernels to run on old distributions and tools, + which might get confused by /sys/class/block/. Since 2007/2008 all +@@ -672,8 +676,22 @@ config SYSFS_DEPRECATED + option enabled. + + Only if you are using a new kernel on an old distribution, you might +- need to say Y here. Never say Y, if the original kernel, that came +- with your distribution, has not set this option. ++ need to say Y here. ++ ++config SYSFS_DEPRECATED_V2 ++ bool "enabled deprecated sysfs features by default" ++ default n ++ depends on SYSFS ++ depends on SYSFS_DEPRECATED ++ help ++ Enable deprecated sysfs by default. ++ ++ See the CONFIG_SYSFS_DEPRECATED option for more details about this ++ option. ++ ++ Only if you are using a new kernel on an old distribution, you might ++ need to say Y here. Even then, odds are you would not need it ++ enabled, you can always pass the boot option if absolutely necessary. + + config RELAY + bool "Kernel->user space relay support (formerly relayfs)" @@ -18,11 +18,13 @@ gregkh/gkh-version.patch ################################# # USB patches for 2.6.36 ################################# +usb.current/usb-fix-bug-in-initialization-of-interface-minor-numbers.patch ################################# # Staging patches for 2.6.36 ################################# +staging.current/staging-ti-st-remove-st_get_plat_device.patch ##################################################################### @@ -44,6 +46,7 @@ driver-core/debugfs-mark-me-as-the-maintainer.patch # can we really almost drop it? please let it happen this time... driver-core/driver-core-remove-config_sysfs_deprecated_v2-but-keep-it-for-block-devices.patch +driver-core/sysfs-allow-boot-time-switching-between-deprecated-and-modern-sysfs-layout.patch ##################################### # TTY patches for after 2.6.36 is out diff --git a/staging.current/staging-ti-st-remove-st_get_plat_device.patch b/staging.current/staging-ti-st-remove-st_get_plat_device.patch new file mode 100644 index 00000000000000..58e702545ae52f --- /dev/null +++ b/staging.current/staging-ti-st-remove-st_get_plat_device.patch @@ -0,0 +1,154 @@ +From dbd3a8709560365ff9b1e5eca263f608877a8a89 Mon Sep 17 00:00:00 2001 +From: Pavan Savoy <pavan_savoy@ti.com> +Date: Thu, 19 Aug 2010 14:08:51 -0400 +Subject: Staging: ti-st: remove st_get_plat_device + +In order to support multiple ST platform devices, a new symbol +'st_get_plat_device' earlier needed to be exported by the arch/XX/brd-XX.c +file which intends to add the ST platform device. + +On removing this dependency, now inside ST driver maintain the array of +ST platform devices that would be registered. +As of now let id=0, as and when we end up having such platforms +where mutliple ST devices can exist, id would come from +protocol drivers (BT, FM and GPS) as to on which platform device +they want to register to. + +Signed-off-by: Pavan Savoy <pavan_savoy@ti.com> +Acked-by: Randy Dunlap <randy.dunlap@oracle.com> +Cc: Anca Emanuel <anca.emanuel@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/staging/ti-st/st.h | 1 - + drivers/staging/ti-st/st_core.c | 9 ++++----- + drivers/staging/ti-st/st_core.h | 2 +- + drivers/staging/ti-st/st_kim.c | 22 +++++++++++++++++++--- + 4 files changed, 24 insertions(+), 10 deletions(-) + +--- a/drivers/staging/ti-st/st.h ++++ b/drivers/staging/ti-st/st.h +@@ -80,5 +80,4 @@ struct st_proto_s { + extern long st_register(struct st_proto_s *); + extern long st_unregister(enum proto_type); + +-extern struct platform_device *st_get_plat_device(void); + #endif /* ST_H */ +--- a/drivers/staging/ti-st/st_core.c ++++ b/drivers/staging/ti-st/st_core.c +@@ -38,7 +38,6 @@ + #include "st_ll.h" + #include "st.h" + +-#define VERBOSE + /* strings to be used for rfkill entries and by + * ST Core to be used for sysfs debug entry + */ +@@ -581,7 +580,7 @@ long st_register(struct st_proto_s *new_ + long err = 0; + unsigned long flags = 0; + +- st_kim_ref(&st_gdata); ++ st_kim_ref(&st_gdata, 0); + pr_info("%s(%d) ", __func__, new_proto->type); + if (st_gdata == NULL || new_proto == NULL || new_proto->recv == NULL + || new_proto->reg_complete_cb == NULL) { +@@ -713,7 +712,7 @@ long st_unregister(enum proto_type type) + + pr_debug("%s: %d ", __func__, type); + +- st_kim_ref(&st_gdata); ++ st_kim_ref(&st_gdata, 0); + if (type < ST_BT || type >= ST_MAX) { + pr_err(" protocol %d not supported", type); + return -EPROTONOSUPPORT; +@@ -767,7 +766,7 @@ long st_write(struct sk_buff *skb) + #endif + long len; + +- st_kim_ref(&st_gdata); ++ st_kim_ref(&st_gdata, 0); + if (unlikely(skb == NULL || st_gdata == NULL + || st_gdata->tty == NULL)) { + pr_err("data/tty unavailable to perform write"); +@@ -818,7 +817,7 @@ static int st_tty_open(struct tty_struct + struct st_data_s *st_gdata; + pr_info("%s ", __func__); + +- st_kim_ref(&st_gdata); ++ st_kim_ref(&st_gdata, 0); + st_gdata->tty = tty; + tty->disc_data = st_gdata; + +--- a/drivers/staging/ti-st/st_core.h ++++ b/drivers/staging/ti-st/st_core.h +@@ -117,7 +117,7 @@ int st_core_init(struct st_data_s **); + void st_core_exit(struct st_data_s *); + + /* ask for reference from KIM */ +-void st_kim_ref(struct st_data_s **); ++void st_kim_ref(struct st_data_s **, int); + + #define GPS_STUB_TEST + #ifdef GPS_STUB_TEST +--- a/drivers/staging/ti-st/st_kim.c ++++ b/drivers/staging/ti-st/st_kim.c +@@ -72,11 +72,26 @@ const unsigned char *protocol_names[] = + PROTO_ENTRY(ST_GPS, "GPS"), + }; + ++#define MAX_ST_DEVICES 3 /* Imagine 1 on each UART for now */ ++struct platform_device *st_kim_devices[MAX_ST_DEVICES]; + + /**********************************************************************/ + /* internal functions */ + + /** ++ * st_get_plat_device - ++ * function which returns the reference to the platform device ++ * requested by id. As of now only 1 such device exists (id=0) ++ * the context requesting for reference can get the id to be ++ * requested by a. The protocol driver which is registering or ++ * b. the tty device which is opened. ++ */ ++static struct platform_device *st_get_plat_device(int id) ++{ ++ return st_kim_devices[id]; ++} ++ ++/** + * validate_firmware_response - + * function to return whether the firmware response was proper + * in case of error don't complete so that waiting for proper +@@ -353,7 +368,7 @@ void st_kim_chip_toggle(enum proto_type + struct kim_data_s *kim_gdata; + pr_info(" %s ", __func__); + +- kim_pdev = st_get_plat_device(); ++ kim_pdev = st_get_plat_device(0); + kim_gdata = dev_get_drvdata(&kim_pdev->dev); + + if (kim_gdata->gpios[type] == -1) { +@@ -574,12 +589,12 @@ static int kim_toggle_radio(void *data, + * This would enable multiple such platform devices to exist + * on a given platform + */ +-void st_kim_ref(struct st_data_s **core_data) ++void st_kim_ref(struct st_data_s **core_data, int id) + { + struct platform_device *pdev; + struct kim_data_s *kim_gdata; + /* get kim_gdata reference from platform device */ +- pdev = st_get_plat_device(); ++ pdev = st_get_plat_device(id); + kim_gdata = dev_get_drvdata(&pdev->dev); + *core_data = kim_gdata->core_data; + } +@@ -623,6 +638,7 @@ static int kim_probe(struct platform_dev + long *gpios = pdev->dev.platform_data; + struct kim_data_s *kim_gdata; + ++ st_kim_devices[pdev->id] = pdev; + kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC); + if (!kim_gdata) { + pr_err("no mem to allocate"); diff --git a/usb.current/usb-fix-bug-in-initialization-of-interface-minor-numbers.patch b/usb.current/usb-fix-bug-in-initialization-of-interface-minor-numbers.patch new file mode 100644 index 00000000000000..1306cdae854528 --- /dev/null +++ b/usb.current/usb-fix-bug-in-initialization-of-interface-minor-numbers.patch @@ -0,0 +1,120 @@ +From stern+4c863d94@rowland.harvard.edu Tue Sep 21 13:01:42 2010 +Date: Tue, 21 Sep 2010 15:01:53 -0400 (EDT) +From: Alan Stern <stern@rowland.harvard.edu> +To: Greg KH <greg@kroah.com> +cc: Jiri Kosina <jkosina@suse.cz>, Phil Turmel <philip@turmel.org>, + Mat <jackdachef@gmail.com>, Guillaume Chazarain <guichaz@gmail.com>, + Andreas Bombe <aeb@debian.org>, + Alex Riesen <raa.lkml@gmail.com>, Gabriel C <nix.or.die@googlemail.com> +Subject: USB: fix bug in initialization of interface minor numbers +Message-ID: <Pine.LNX.4.44L0.1009211458000.1644-100000@iolanthe.rowland.org> + +Recent changes in the usbhid layer exposed a bug in usbcore. If +CONFIG_USB_DYNAMIC_MINORS is enabled then an interface may be assigned +a minor number of 0. However interfaces that aren't registered as USB +class devices also have their minor number set to 0, during +initialization. As a result usb_find_interface() may return the +wrong interface, leading to a crash. + +This patch (as1418) fixes the problem by initializing every +interface's minor number to -1. It also cleans up the +usb_register_dev() function, which besides being somewhat awkwardly +written, does not unwind completely on all its error paths. + +Signed-off-by: Alan Stern <stern@rowland.harvard.edu> +Tested-by: Philip J. Turmel <philip@turmel.org> +Tested-by: Gabriel Craciunescu <nix.or.die@googlemail.com> +Tested-by: Alex Riesen <raa.lkml@gmail.com> +CC: Jiri Kosina <jkosina@suse.cz> +Cc: stable <stable@kernel.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/core/file.c | 35 ++++++++++++++++------------------- + drivers/usb/core/message.c | 1 + + 2 files changed, 17 insertions(+), 19 deletions(-) + +--- a/drivers/usb/core/file.c ++++ b/drivers/usb/core/file.c +@@ -159,9 +159,9 @@ void usb_major_cleanup(void) + int usb_register_dev(struct usb_interface *intf, + struct usb_class_driver *class_driver) + { +- int retval = -EINVAL; ++ int retval; + int minor_base = class_driver->minor_base; +- int minor = 0; ++ int minor; + char name[20]; + char *temp; + +@@ -173,12 +173,17 @@ int usb_register_dev(struct usb_interfac + */ + minor_base = 0; + #endif +- intf->minor = -1; +- +- dbg ("looking for a minor, starting at %d", minor_base); + + if (class_driver->fops == NULL) +- goto exit; ++ return -EINVAL; ++ if (intf->minor >= 0) ++ return -EADDRINUSE; ++ ++ retval = init_usb_class(); ++ if (retval) ++ return retval; ++ ++ dev_dbg(&intf->dev, "looking for a minor, starting at %d", minor_base); + + down_write(&minor_rwsem); + for (minor = minor_base; minor < MAX_USB_MINORS; ++minor) { +@@ -186,20 +191,12 @@ int usb_register_dev(struct usb_interfac + continue; + + usb_minors[minor] = class_driver->fops; +- +- retval = 0; ++ intf->minor = minor; + break; + } + up_write(&minor_rwsem); +- +- if (retval) +- goto exit; +- +- retval = init_usb_class(); +- if (retval) +- goto exit; +- +- intf->minor = minor; ++ if (intf->minor < 0) ++ return -EXFULL; + + /* create a usb class device for this usb interface */ + snprintf(name, sizeof(name), class_driver->name, minor - minor_base); +@@ -213,11 +210,11 @@ int usb_register_dev(struct usb_interfac + "%s", temp); + if (IS_ERR(intf->usb_dev)) { + down_write(&minor_rwsem); +- usb_minors[intf->minor] = NULL; ++ usb_minors[minor] = NULL; ++ intf->minor = -1; + up_write(&minor_rwsem); + retval = PTR_ERR(intf->usb_dev); + } +-exit: + return retval; + } + EXPORT_SYMBOL_GPL(usb_register_dev); +--- a/drivers/usb/core/message.c ++++ b/drivers/usb/core/message.c +@@ -1802,6 +1802,7 @@ free_interfaces: + intf->dev.groups = usb_interface_groups; + intf->dev.dma_mask = dev->dev.dma_mask; + INIT_WORK(&intf->reset_ws, __usb_queue_reset_device); ++ intf->minor = -1; + device_initialize(&intf->dev); + dev_set_name(&intf->dev, "%d-%s:%d.%d", + dev->bus->busnum, dev->devpath, |
