* [BK PATCH] More Driver Core patches for 2.6.10-rc1 @ 2004-11-12 22:58 Greg KH 2004-11-12 23:00 ` [PATCH] " Greg KH 2004-11-13 20:51 ` [BK PATCH] " Linus Torvalds 0 siblings, 2 replies; 25+ messages in thread From: Greg KH @ 2004-11-12 22:58 UTC (permalink / raw) To: torvalds, akpm; +Cc: linux-kernel Hi, Here are a few driver core and sysfs patches and fixes for 2.6.10-rc1. They fix some minor bugs in sysfs, add some more environment variables to /sbin/hotplug to make userspace easier, and shrink the size of struct device. Please pull from: bk://kernel.bkbits.net/gregkh/linux/driver-2.6 thanks, greg k-h p.s. I'll send these as patches in response to this email to lkml for those who want to see them. arch/arm/common/locomo.c | 3 --- arch/arm/common/sa1111.c | 23 +++++++++++++++-------- arch/arm/mach-sa1100/neponset.c | 23 +++++++++++++++-------- drivers/base/bus.c | 2 +- drivers/base/class.c | 6 ++++++ drivers/base/core.c | 21 +++++++++++++++++++++ drivers/block/genhd.c | 6 ++++++ drivers/video/aty/aty128fb.c | 10 +++++----- drivers/video/aty/atyfb_base.c | 10 +++++----- drivers/video/aty/radeon_pm.c | 6 +++--- fs/sysfs/dir.c | 8 ++++---- include/linux/device.h | 5 ----- include/linux/kobject_uevent.h | 1 + lib/kobject_uevent.c | 8 +++++--- 14 files changed, 87 insertions(+), 45 deletions(-) ----- Anil Keshavamurthy: o Add KOBJ_ONLINE David Brownell: o driver core: shrink struct device a bit Greg Kroah-Hartman: o sysfs: fix odd patch error o driver core: fix up some missed power_state changes from David's patch Kay Sievers: o print hotplug SEQNUM as unsigned o add the bus name to the hotplug environment o add the driver name to the hotplug environment Maneesh Soni: o sysfs: fix duplicate driver registration error Milton D. Miller II: o fix sysfs backing store error path confusion ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 22:58 [BK PATCH] More Driver Core patches for 2.6.10-rc1 Greg KH @ 2004-11-12 23:00 ` Greg KH 2004-11-12 23:00 ` Greg KH 2004-11-13 20:51 ` [BK PATCH] " Linus Torvalds 1 sibling, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2093, 2004/11/12 11:41:25-08:00, david-b@pacbell.net [PATCH] driver core: shrink struct device a bit This patch removes two fields from "struct device" that are duplicated in "struct dev_pm_info": power_state (which should probably vanish) and "saved_state". There were only two "real" uses of saved_state; both are now switched over to use dev_pm_info. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> arch/arm/common/locomo.c | 3 --- arch/arm/common/sa1111.c | 23 +++++++++++++++-------- arch/arm/mach-sa1100/neponset.c | 23 +++++++++++++++-------- include/linux/device.h | 5 ----- 4 files changed, 30 insertions(+), 24 deletions(-) diff -Nru a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c --- a/arch/arm/common/locomo.c 2004-11-12 14:53:41 -08:00 +++ b/arch/arm/common/locomo.c 2004-11-12 14:53:41 -08:00 @@ -627,9 +627,6 @@ if (lchip) { __locomo_remove(lchip); dev_set_drvdata(dev, NULL); - - kfree(dev->saved_state); - dev->saved_state = NULL; } return 0; diff -Nru a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c --- a/arch/arm/common/sa1111.c 2004-11-12 14:53:41 -08:00 +++ b/arch/arm/common/sa1111.c 2004-11-12 14:53:41 -08:00 @@ -797,6 +797,8 @@ unsigned int wakeen1; }; +#ifdef CONFIG_PM + static int sa1111_suspend(struct device *dev, u32 state, u32 level) { struct sa1111 *sachip = dev_get_drvdata(dev); @@ -808,11 +810,10 @@ if (level != SUSPEND_DISABLE) return 0; - dev->saved_state = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL); - if (!dev->saved_state) + save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL); + if (!save) return -ENOMEM; - - save = (struct sa1111_save_data *)dev->saved_state; + dev->power.saved_state = save; spin_lock_irqsave(&sachip->lock, flags); @@ -870,7 +871,7 @@ if (level != RESUME_ENABLE) return 0; - save = (struct sa1111_save_data *)dev->saved_state; + save = (struct sa1111_save_data *)dev->power.saved_state; if (!save) return 0; @@ -915,12 +916,18 @@ spin_unlock_irqrestore(&sachip->lock, flags); - dev->saved_state = NULL; + dev->power.saved_state = NULL; kfree(save); return 0; } +#else /* !CONFIG_PM */ +#define sa1111_resume NULL +#define sa1111_suspend NULL +#endif /* !CONFIG_PM */ + + static int sa1111_probe(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -943,8 +950,8 @@ __sa1111_remove(sachip); dev_set_drvdata(dev, NULL); - kfree(dev->saved_state); - dev->saved_state = NULL; + kfree(dev->power.saved_state); + dev->power.saved_state = NULL; } return 0; diff -Nru a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c --- a/arch/arm/mach-sa1100/neponset.c 2004-11-12 14:53:41 -08:00 +++ b/arch/arm/mach-sa1100/neponset.c 2004-11-12 14:53:41 -08:00 @@ -173,6 +173,8 @@ return 0; } +#ifdef CONFIG_PM + /* * LDM power management. */ @@ -184,12 +186,12 @@ if (level == SUSPEND_SAVE_STATE || level == SUSPEND_DISABLE || level == SUSPEND_POWER_DOWN) { - if (!dev->saved_state) - dev->saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL); - if (!dev->saved_state) + if (!dev->power.saved_state) + dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL); + if (!dev->power.saved_state) return -ENOMEM; - *(unsigned int *)dev->saved_state = NCR_0; + *(unsigned int *)dev->power.saved_state = NCR_0; } return 0; @@ -198,15 +200,20 @@ static int neponset_resume(struct device *dev, u32 level) { if (level == RESUME_RESTORE_STATE || level == RESUME_ENABLE) { - if (dev->saved_state) { - NCR_0 = *(unsigned int *)dev->saved_state; - kfree(dev->saved_state); - dev->saved_state = NULL; + if (dev->power.saved_state) { + NCR_0 = *(unsigned int *)dev->power.saved_state; + kfree(dev->power.saved_state); + dev->power.saved_state = NULL; } } return 0; } + +#else +#define neponset_suspend NULL +#define neponset_resume NULL +#endif static struct device_driver neponset_device_driver = { .name = "neponset", diff -Nru a/include/linux/device.h b/include/linux/device.h --- a/include/linux/device.h 2004-11-12 14:53:41 -08:00 +++ b/include/linux/device.h 2004-11-12 14:53:41 -08:00 @@ -268,12 +268,7 @@ void *platform_data; /* Platform specific data (e.g. ACPI, BIOS data relevant to device) */ struct dev_pm_info power; - u32 power_state; /* Current operating state. In - ACPI-speak, this is D0-D3, D0 - being fully functional, and D3 - being off. */ - unsigned char *saved_state; /* saved device state */ u32 detach_state; /* State to enter when device is detached from its driver. */ ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 23:00 ` [PATCH] " Greg KH @ 2004-11-12 23:00 ` Greg KH 2004-11-12 23:00 ` Greg KH [not found] ` <20041113000052.GC346@electric-eye.fr.zoreil.com> 0 siblings, 2 replies; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2094, 2004/11/12 11:42:03-08:00, miltonm@bga.com [PATCH] fix sysfs backing store error path confusion On Nov 3, 2004, at 3:42 PM, Greg KH wrote: |On Tue, Nov 02, 2004 at 10:03:34AM -0600, Maneesh Soni wrote: ||On Tue, Nov 02, 2004 at 02:46:58AM -0600, Milton Miller wrote: |||sysfs_new_dirent returns ERR_PTR(-ENOMEM) if kmalloc fails but the callers |||were expecting NULL. || ||Thanks for spotting this. But as you said, I will prefer to change the callee. ||How about this patch? .. ||- return -ENOMEM; ||+ return NULL; | |Actually, this needs to be a 0, not NULL, otherwise the compiler |complains with a warning. I've fixed it up and applied it. | |thanks, | |greg k-h I wondered why greg thought the type was wrong. After it was merged I realized that the wrong function was changed. Here's an attempt to fix both errors. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> fs/sysfs/dir.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c --- a/fs/sysfs/dir.c 2004-11-12 14:53:33 -08:00 +++ b/fs/sysfs/dir.c 2004-11-12 14:53:33 -08:00 @@ -38,7 +38,7 @@ sd = kmalloc(sizeof(*sd), GFP_KERNEL); if (!sd) - return ERR_PTR(-ENOMEM); + return NULL; memset(sd, 0, sizeof(*sd)); atomic_set(&sd->s_count, 1); @@ -56,7 +56,7 @@ sd = sysfs_new_dirent(parent_sd, element); if (!sd) - return 0; + return -ENOMEMurn -ENOMEM; sd->s_mode = mode; sd->s_type = type; ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 23:00 ` Greg KH @ 2004-11-12 23:00 ` Greg KH 2004-11-12 23:00 ` Greg KH [not found] ` <20041113000052.GC346@electric-eye.fr.zoreil.com> 1 sibling, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2095, 2004/11/12 11:42:28-08:00, anil.s.keshavamurthy@intel.com [PATCH] Add KOBJ_ONLINE I am trying to fix the current ACPI container.ko and processor.ko to use kobject_hotplug() for notification. For this I would be requiring the KOBJ_ONLINE definitions to be added to kobject_action. Signed-off-by: Anil Keshavamurty <anil.s.keshavamurthy@intel.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> include/linux/kobject_uevent.h | 1 + lib/kobject_uevent.c | 2 ++ 2 files changed, 3 insertions(+) diff -Nru a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h --- a/include/linux/kobject_uevent.h 2004-11-12 14:53:26 -08:00 +++ b/include/linux/kobject_uevent.h 2004-11-12 14:53:26 -08:00 @@ -28,6 +28,7 @@ KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */ KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */ KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */ + KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */ }; diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c --- a/lib/kobject_uevent.c 2004-11-12 14:53:26 -08:00 +++ b/lib/kobject_uevent.c 2004-11-12 14:53:26 -08:00 @@ -42,6 +42,8 @@ return "umount"; case KOBJ_OFFLINE: return "offline"; + case KOBJ_ONLINE: + return "online"; default: return NULL; } ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 23:00 ` Greg KH @ 2004-11-12 23:00 ` Greg KH 2004-11-12 23:00 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2096, 2004/11/12 11:42:46-08:00, maneesh@in.ibm.com [PATCH] sysfs: fix duplicate driver registration error o Do not release existing directory if the new directory happens to be a duplicate directory. Thanks to Kay Sievers for the testcase. Signed-off-by: Maneesh Soni <maneesh@in.ibm.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> fs/sysfs/dir.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c --- a/fs/sysfs/dir.c 2004-11-12 14:53:18 -08:00 +++ b/fs/sysfs/dir.c 2004-11-12 14:53:18 -08:00 @@ -111,7 +111,7 @@ d_rehash(*d); } } - if (error) + if (error && (error != -EEXIST)) d_drop(*d); dput(*d); } else ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 23:00 ` Greg KH @ 2004-11-12 23:00 ` Greg KH 2004-11-12 23:00 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2097, 2004/11/12 11:43:08-08:00, kay.sievers@vrfy.org [PATCH] add the driver name to the hotplug environment Add the name of the device's driver to the hotplug environment of class and block devices. ACTION=add DEVPATH=/block/sda SUBSYSTEM=block SEQNUM=986 PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/host0/target0:0:0/0:0:0:0 PHYSDEVBUS=scsi PHYSDEVDRIVER=sd Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> drivers/base/class.c | 6 ++++++ drivers/block/genhd.c | 6 ++++++ 2 files changed, 12 insertions(+) diff -Nru a/drivers/base/class.c b/drivers/base/class.c --- a/drivers/base/class.c 2004-11-12 14:53:11 -08:00 +++ b/drivers/base/class.c 2004-11-12 14:53:11 -08:00 @@ -303,6 +303,12 @@ buffer, buffer_size, &length, "PHYSDEVBUS=%s", dev->bus->name); + /* add driver name of physical device */ + if (dev->driver) + add_hotplug_env_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVDRIVER=%s", dev->driver->name); + /* terminate, set to next free slot, shrink available space */ envp[i] = NULL; envp = &envp[i]; diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c --- a/drivers/block/genhd.c 2004-11-12 14:53:11 -08:00 +++ b/drivers/block/genhd.c 2004-11-12 14:53:11 -08:00 @@ -469,6 +469,12 @@ buffer, buffer_size, &length, "PHYSDEVBUS=%s", dev->bus->name); + /* add driver name of physical device */ + if (dev->driver) + add_hotplug_env_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVDRIVER=%s", dev->driver->name); + envp[i] = NULL; } ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 23:00 ` Greg KH @ 2004-11-12 23:00 ` Greg KH 2004-11-12 23:00 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2098, 2004/11/12 11:43:27-08:00, kay.sievers@vrfy.org [PATCH] add the bus name to the hotplug environment Add the name of the bus and the driver to the hotplug event for /sys/devices/*. With this addition, userspace knows what it can expect from sysfs to show up, instead of waiting for a timeout for devices without a bus. ACTION=add DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb3/3-1 SUBSYSTEM=usb SEQNUM=978 PHYSDEVBUS=usb PHYSDEVDRIVER=usb Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> drivers/base/bus.c | 2 +- drivers/base/core.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c --- a/drivers/base/bus.c 2004-11-12 14:53:04 -08:00 +++ b/drivers/base/bus.c 2004-11-12 14:53:04 -08:00 @@ -247,7 +247,7 @@ * device_bind_driver - bind a driver to one device. * @dev: device. * - * Allow manual attachment of a driver to a deivce. + * Allow manual attachment of a driver to a device. * Caller must have already set @dev->driver. * * Note that this does not modify the bus reference count diff -Nru a/drivers/base/core.c b/drivers/base/core.c --- a/drivers/base/core.c 2004-11-12 14:53:04 -08:00 +++ b/drivers/base/core.c 2004-11-12 14:53:04 -08:00 @@ -116,7 +116,28 @@ int num_envp, char *buffer, int buffer_size) { struct device *dev = to_dev(kobj); + int i = 0; + int length = 0; int retval = 0; + + /* add bus name of physical device */ + if (dev->bus) + add_hotplug_env_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVBUS=%s", dev->bus->name); + + /* add driver name of physical device */ + if (dev->driver) + add_hotplug_env_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVDRIVER=%s", dev->driver->name); + + /* terminate, set to next free slot, shrink available space */ + envp[i] = NULL; + envp = &envp[i]; + num_envp -= i; + buffer = &buffer[length]; + buffer_size -= length; if (dev->bus->hotplug) { /* have the bus specific function add its stuff */ ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 23:00 ` Greg KH @ 2004-11-12 23:00 ` Greg KH 2004-11-12 23:00 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2099, 2004/11/12 11:43:49-08:00, kay.sievers@vrfy.org [PATCH] print hotplug SEQNUM as unsigned Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> lib/kobject_uevent.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c --- a/lib/kobject_uevent.c 2004-11-12 14:52:56 -08:00 +++ b/lib/kobject_uevent.c 2004-11-12 14:52:56 -08:00 @@ -289,10 +289,10 @@ spin_lock(&sequence_lock); seq = ++hotplug_seqnum; spin_unlock(&sequence_lock); - sprintf(seq_buff, "SEQNUM=%lld", (long long)seq); + sprintf(seq_buff, "SEQNUM=%llu", (unsigned long long)seq); - pr_debug ("%s: %s %s seq=%lld %s %s %s %s %s\n", - __FUNCTION__, argv[0], argv[1], (long long)seq, + pr_debug ("%s: %s %s seq=%llu %s %s %s %s %s\n", + __FUNCTION__, argv[0], argv[1], (unsigned long long)seq, envp[0], envp[1], envp[2], envp[3], envp[4]); send_uevent(action_string, kobj_path, envp, GFP_KERNEL); ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 23:00 ` Greg KH @ 2004-11-12 23:00 ` Greg KH 2004-11-12 23:00 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2100, 2004/11/12 11:44:09-08:00, greg@kroah.com [PATCH] driver core: fix up some missed power_state changes from David's patch Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> drivers/video/aty/aty128fb.c | 10 +++++----- drivers/video/aty/atyfb_base.c | 10 +++++----- drivers/video/aty/radeon_pm.c | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff -Nru a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c --- a/drivers/video/aty/aty128fb.c 2004-11-12 14:52:49 -08:00 +++ b/drivers/video/aty/aty128fb.c 2004-11-12 14:52:49 -08:00 @@ -2363,7 +2363,7 @@ state = 2; #endif /* CONFIG_PPC_PMAC */ - if (state != 2 || state == pdev->dev.power_state) + if (state != 2 || state == pdev->dev.power.power_state) return 0; printk(KERN_DEBUG "aty128fb: suspending...\n"); @@ -2394,7 +2394,7 @@ release_console_sem(); - pdev->dev.power_state = state; + pdev->dev.power.power_state = state; return 0; } @@ -2404,13 +2404,13 @@ struct fb_info *info = pci_get_drvdata(pdev); struct aty128fb_par *par = info->par; - if (pdev->dev.power_state == 0) + if (pdev->dev.power.power_state == 0) return 0; acquire_console_sem(); /* Wakeup chip */ - if (pdev->dev.power_state == 2) + if (pdev->dev.power.power_state == 2) aty128_set_suspend(par, 0); par->asleep = 0; @@ -2430,7 +2430,7 @@ release_console_sem(); - pdev->dev.power_state = 0; + pdev->dev.power.power_state = 0; printk(KERN_DEBUG "aty128fb: resumed !\n"); diff -Nru a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c --- a/drivers/video/aty/atyfb_base.c 2004-11-12 14:52:49 -08:00 +++ b/drivers/video/aty/atyfb_base.c 2004-11-12 14:52:49 -08:00 @@ -2033,7 +2033,7 @@ state = 2; #endif /* CONFIG_PPC_PMAC */ - if (state != 2 || state == pdev->dev.power_state) + if (state != 2 || state == pdev->dev.power.power_state) return 0; acquire_console_sem(); @@ -2062,7 +2062,7 @@ release_console_sem(); - pdev->dev.power_state = state; + pdev->dev.power.power_state = state; return 0; } @@ -2072,12 +2072,12 @@ struct fb_info *info = pci_get_drvdata(pdev); struct atyfb_par *par = (struct atyfb_par *) info->par; - if (pdev->dev.power_state == 0) + if (pdev->dev.power.power_state == 0) return 0; acquire_console_sem(); - if (pdev->dev.power_state == 2) + if (pdev->dev.power.power_state == 2) aty_power_mgmt(0, par); par->asleep = 0; @@ -2093,7 +2093,7 @@ release_console_sem(); - pdev->dev.power_state = 0; + pdev->dev.power.power_state = 0; return 0; } diff -Nru a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c --- a/drivers/video/aty/radeon_pm.c 2004-11-12 14:52:49 -08:00 +++ b/drivers/video/aty/radeon_pm.c 2004-11-12 14:52:49 -08:00 @@ -898,7 +898,7 @@ release_console_sem(); - pdev->dev.power_state = state; + pdev->dev.power.power_state = state; return 0; } @@ -908,7 +908,7 @@ struct fb_info *info = pci_get_drvdata(pdev); struct radeonfb_info *rinfo = info->par; - if (pdev->dev.power_state == 0) + if (pdev->dev.power.power_state == 0) return 0; acquire_console_sem(); @@ -935,7 +935,7 @@ release_console_sem(); - pdev->dev.power_state = 0; + pdev->dev.power.power_state = 0; printk(KERN_DEBUG "radeonfb: resumed !\n"); ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 23:00 ` Greg KH @ 2004-11-12 23:00 ` Greg KH 0 siblings, 0 replies; 25+ messages in thread From: Greg KH @ 2004-11-12 23:00 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2101, 2004/11/12 12:46:17-08:00, greg@kroah.com sysfs: fix odd patch error Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> fs/sysfs/dir.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c --- a/fs/sysfs/dir.c 2004-11-12 14:52:41 -08:00 +++ b/fs/sysfs/dir.c 2004-11-12 14:52:41 -08:00 @@ -56,7 +56,7 @@ sd = sysfs_new_dirent(parent_sd, element); if (!sd) - return -ENOMEMurn -ENOMEM; + return -ENOMEM; sd->s_mode = mode; sd->s_type = type; ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <20041113000052.GC346@electric-eye.fr.zoreil.com>]
[parent not found: <200411130020.17494.lists@kenneth.aafloy.net>]
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 [not found] ` <200411130020.17494.lists@kenneth.aafloy.net> @ 2004-11-13 0:44 ` Greg KH 0 siblings, 0 replies; 25+ messages in thread From: Greg KH @ 2004-11-13 0:44 UTC (permalink / raw) To: Kenneth Aafl?y, Francois Romieu; +Cc: linux-kernel Replied to both of you, and the list, to prevent others from pointing out the same thing multiple times :) Oh, it's nice to see that people actually read these patches, I like it. On Sat, Nov 13, 2004 at 12:20:17AM +0100, Kenneth Aafl?y wrote: > On Saturday 13 November 2004 00:00, Greg KH wrote: > > ChangeSet 1.2094, 2004/11/12 11:42:03-08:00, miltonm@bga.com > > > > [PATCH] fix sysfs backing store error path confusion > [snip] > > sd = sysfs_new_dirent(parent_sd, element); > > if (!sd) > > - return 0; > > + return -ENOMEMurn -ENOMEM; > > Confusingly strange :) > > Kenneth On Sat, Nov 13, 2004 at 01:00:52AM +0100, Francois Romieu wrote: > Greg KH <greg@kroah.com> : > [...] > > diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c > > --- a/fs/sysfs/dir.c 2004-11-12 14:53:33 -08:00 > > +++ b/fs/sysfs/dir.c 2004-11-12 14:53:33 -08:00 > [...] > > @@ -56,7 +56,7 @@ > > > > sd = sysfs_new_dirent(parent_sd, element); > > if (!sd) > > - return 0; > > + return -ENOMEMurn -ENOMEM; > > Oops. Yeah, I don't know what happened with my tools here. But if you look at the next patch in the series, I fixed it. thanks, greg k-h ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [BK PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-12 22:58 [BK PATCH] More Driver Core patches for 2.6.10-rc1 Greg KH 2004-11-12 23:00 ` [PATCH] " Greg KH @ 2004-11-13 20:51 ` Linus Torvalds 2004-11-13 21:10 ` Greg KH 1 sibling, 1 reply; 25+ messages in thread From: Linus Torvalds @ 2004-11-13 20:51 UTC (permalink / raw) To: Greg KH; +Cc: akpm, linux-kernel On Fri, 12 Nov 2004, Greg KH wrote: > > David Brownell: > o driver core: shrink struct device a bit > > Greg Kroah-Hartman: > o driver core: fix up some missed power_state changes from David's patch Hmm. Apparently drivers/ide/ppc/pmac.c wasn't among those fixed up: drivers/ide/ppc/pmac.c: In function `pmac_ide_macio_suspend': drivers/ide/ppc/pmac.c:1363: error: structure has no member named `power_state' drivers/ide/ppc/pmac.c:1366: error: structure has no member named `power_state' ... Is it always valid to just replace dev->dev.power_state with dev->dev.power.power_state or is there anything subtler going on? Linus ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [BK PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-13 20:51 ` [BK PATCH] " Linus Torvalds @ 2004-11-13 21:10 ` Greg KH 0 siblings, 0 replies; 25+ messages in thread From: Greg KH @ 2004-11-13 21:10 UTC (permalink / raw) To: Linus Torvalds; +Cc: akpm, linux-kernel On Sat, Nov 13, 2004 at 12:51:41PM -0800, Linus Torvalds wrote: > > > On Fri, 12 Nov 2004, Greg KH wrote: > > > > David Brownell: > > o driver core: shrink struct device a bit > > > > Greg Kroah-Hartman: > > o driver core: fix up some missed power_state changes from David's patch > > Hmm. Apparently drivers/ide/ppc/pmac.c wasn't among those fixed up: > > drivers/ide/ppc/pmac.c: In function `pmac_ide_macio_suspend': > drivers/ide/ppc/pmac.c:1363: error: structure has no member named `power_state' > drivers/ide/ppc/pmac.c:1366: error: structure has no member named `power_state' > ... Oops, sorry about that. > Is it always valid to just replace > > dev->dev.power_state > > with > > dev->dev.power.power_state Yes it is. > or is there anything subtler going on? Nope, nothing subtle here :) thanks, greg k-h ^ permalink raw reply [flat|nested] 25+ messages in thread
* [BK PATCH] More USB patches for 2.6.10-rc1 @ 2004-11-05 0:35 Greg KH 2004-11-05 0:48 ` [PATCH] More Driver Core " Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:35 UTC (permalink / raw) To: torvalds, akpm; +Cc: linux-usb-devel, linux-kernel Hi, Here are some more USB fixes and changes for 2.6.10-rc1. All of these patches should have been in the past few -mm releases. Big fix here is some PCI suspend fixes (yeah, it came along with some USB suspend fixes, so it all got mushed together...) Please pull from: bk://kernel.bkbits.net/gregkh/linux/usb-2.6 Patches will be posted to linux-usb-devel as a follow-up thread for those who want to see them. thanks, greg k-h Documentation/usb/usb-serial.txt | 56 + MAINTAINERS | 16 drivers/block/Kconfig | 2 drivers/block/ub.c | 62 + drivers/pci/pci-driver.c | 4 drivers/pci/quirks.c | 6 drivers/usb/core/devio.c | 8 drivers/usb/core/hcd-pci.c | 100 ++- drivers/usb/core/hcd.c | 61 + drivers/usb/core/hcd.h | 10 drivers/usb/core/hub.c | 36 - drivers/usb/core/message.c | 25 drivers/usb/core/usb.c | 8 drivers/usb/gadget/Makefile | 2 drivers/usb/gadget/dummy_hcd.c | 452 +++++++------ drivers/usb/gadget/ether.c | 4 drivers/usb/gadget/file_storage.c | 4 drivers/usb/gadget/serial.c | 875 ++++++++++++++++++++------- drivers/usb/gadget/zero.c | 2 drivers/usb/host/ehci-hcd.c | 146 ++-- drivers/usb/host/ehci-hub.c | 48 - drivers/usb/host/ehci-mem.c | 5 drivers/usb/host/ehci-q.c | 3 drivers/usb/host/ehci-sched.c | 7 drivers/usb/host/ehci.h | 13 drivers/usb/host/ohci-dbg.c | 144 ++-- drivers/usb/host/ohci-hcd.c | 110 +-- drivers/usb/host/ohci-hub.c | 111 +-- drivers/usb/host/ohci-lh7a404.c | 10 drivers/usb/host/ohci-mem.c | 11 drivers/usb/host/ohci-omap.c | 34 - drivers/usb/host/ohci-pci.c | 1 drivers/usb/host/ohci-pxa27x.c | 10 drivers/usb/host/ohci-q.c | 189 +++-- drivers/usb/host/ohci-sa1111.c | 10 drivers/usb/host/ohci.h | 262 +++++--- drivers/usb/host/uhci-hcd.c | 42 - drivers/usb/host/uhci-hcd.h | 2 drivers/usb/host/uhci-hub.c | 2 drivers/usb/input/hid-core.c | 11 drivers/usb/input/powermate.c | 2 drivers/usb/media/stv680.c | 6 drivers/usb/media/usbvideo.c | 79 -- drivers/usb/net/Kconfig | 8 drivers/usb/net/catc.c | 4 drivers/usb/net/usbnet.c | 18 drivers/usb/serial/Kconfig | 15 drivers/usb/serial/Makefile | 1 drivers/usb/serial/cypress_m8.c | 1230 +++++++++++++++++++++++++++++++++++++- drivers/usb/serial/cypress_m8.h | 55 + drivers/usb/serial/pl2303.c | 3 drivers/usb/serial/pl2303.h | 14 drivers/usb/serial/usb-serial.c | 111 ++- drivers/usb/serial/usb-serial.h | 16 54 files changed, 3301 insertions(+), 1165 deletions(-) ----- <arjan:fenrus.demon.nl>: o USB: remove dead code in usb video <lmendez19:austin.rr.com>: o cypress_m8: add usb-serial driver 'cypress_m8' to kernel tree o usb-serial: add interrupt out support and improved debug messages o hid-core: add two devices to device blacklist Adrian Bunk: o USB ohci-dbg.c: remove an unused function o USB stv680.c: remove an unused function Alan Stern: o usbcore: add comment to updated hcd.h o dummy-hcd: removal hcd release o Non-PCI OHCI drivers: remove hcd release o USB PCI drivers: hcd release changes o usbcore: Make the core release hcd structures o dummy-hcd: Refactor startup and shutdown o dummy_hcd: minor fixups o UHCI: Use a sane timeout for device initialization o USB: Dequeuing of root-hub URBs o UHCI: Workaround for broken remote wakeup Arnaldo Carvalho de Melo: o USB: add id for Siemens x65 series of mobiles to pl2303 driver David Brownell: o USB: ohci-omap, updates for omap1510/5910 and innovator o USB: usb gadget serial driver v2.0 o USB: usb gadget drivers, minor tweaks o USB: ohci, hooks for big-endian registers o USB: ohci, remove pre-byteswapped constants o USB: clean up error messages o USB: fix bug o USB: fix ohci_restart warning o usbcore, diagnostic tweaks o OHCI suspend/resume updates (minor) o EHCI suspend/resume updates o PCI: make pci_save_state() only happen when no suspend() o usbcore and system sleep states Greg Kroah-Hartman: o USB: fix sparse warnings in cypress_m8 driver o USB: fix up pl2303 device ids that ended up getting duplicated o USB: fix up serial object reference count bug on error path Jonathan McDowell: o USB: add KC2190 support for usbnet Karsten Wiese: o UHCI: Convert remainder to bitwise-and Nishanth Aravamudan: o pci/quirks: replace schedule_timeout() with msleep() Pete Zaitcev: o USB: Patch for ub Thomas Gleixner: o Lock initializer unifying Batch 2 (USB) ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:35 [BK PATCH] More USB " Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.1, 2004/11/03 13:50:35-08:00, maneesh@in.ibm.com [PATCH] sysfs: fix sysfs backing store error path confusion o sysfs_new_dirent to retrun 0 if kmalloc fails. Thanks to Milton Miller for spotting this. Signed-off-by: Maneesh Soni <maneesh@in.ibm.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> fs/sysfs/dir.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c --- a/fs/sysfs/dir.c 2004-11-04 16:31:16 -08:00 +++ b/fs/sysfs/dir.c 2004-11-04 16:31:16 -08:00 @@ -56,7 +56,7 @@ sd = sysfs_new_dirent(parent_sd, element); if (!sd) - return -ENOMEM; + return 0; sd->s_mode = mode; sd->s_type = type; ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` [PATCH] More Driver Core " Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.2, 2004/11/03 13:50:47-08:00, bunk@stusta.de [PATCH] small sysfs cleanups The patch below does the following cleanups for the sysfs code: - remove the unused global function sysfs_mknod - make some structs and functions static Please check whether this patch is correct, or whether some of the things I made static should be used globally in the forseeable future. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> fs/sysfs/dir.c | 2 +- fs/sysfs/inode.c | 5 ----- fs/sysfs/mount.c | 2 +- fs/sysfs/symlink.c | 17 +++++++++-------- fs/sysfs/sysfs.h | 2 -- 5 files changed, 11 insertions(+), 17 deletions(-) diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c --- a/fs/sysfs/dir.c 2004-11-04 16:31:09 -08:00 +++ b/fs/sysfs/dir.c 2004-11-04 16:31:09 -08:00 @@ -201,7 +201,7 @@ return err; } -struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, +static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) { struct sysfs_dirent * parent_sd = dentry->d_parent->d_fsdata; diff -Nru a/fs/sysfs/inode.c b/fs/sysfs/inode.c --- a/fs/sysfs/inode.c 2004-11-04 16:31:09 -08:00 +++ b/fs/sysfs/inode.c 2004-11-04 16:31:09 -08:00 @@ -76,11 +76,6 @@ return error; } -int sysfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) -{ - return sysfs_create(dentry, mode, NULL); -} - struct dentry * sysfs_get_dentry(struct dentry * parent, const char * name) { struct qstr qstr; diff -Nru a/fs/sysfs/mount.c b/fs/sysfs/mount.c --- a/fs/sysfs/mount.c 2004-11-04 16:31:09 -08:00 +++ b/fs/sysfs/mount.c 2004-11-04 16:31:09 -08:00 @@ -22,7 +22,7 @@ .drop_inode = generic_delete_inode, }; -struct sysfs_dirent sysfs_root = { +static struct sysfs_dirent sysfs_root = { .s_sibling = LIST_HEAD_INIT(sysfs_root.s_sibling), .s_children = LIST_HEAD_INIT(sysfs_root.s_children), .s_element = NULL, diff -Nru a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c --- a/fs/sysfs/symlink.c 2004-11-04 16:31:09 -08:00 +++ b/fs/sysfs/symlink.c 2004-11-04 16:31:09 -08:00 @@ -9,12 +9,6 @@ #include "sysfs.h" -struct inode_operations sysfs_symlink_inode_operations = { - .readlink = generic_readlink, - .follow_link = sysfs_follow_link, - .put_link = sysfs_put_link, -}; - static int object_depth(struct kobject * kobj) { struct kobject * p = kobj; @@ -157,7 +151,7 @@ } -int sysfs_follow_link(struct dentry *dentry, struct nameidata *nd) +static int sysfs_follow_link(struct dentry *dentry, struct nameidata *nd) { int error = -ENOMEM; unsigned long page = get_zeroed_page(GFP_KERNEL); @@ -167,12 +161,19 @@ return 0; } -void sysfs_put_link(struct dentry *dentry, struct nameidata *nd) +static void sysfs_put_link(struct dentry *dentry, struct nameidata *nd) { char *page = nd_get_link(nd); if (!IS_ERR(page)) free_page((unsigned long)page); } + +struct inode_operations sysfs_symlink_inode_operations = { + .readlink = generic_readlink, + .follow_link = sysfs_follow_link, + .put_link = sysfs_put_link, +}; + EXPORT_SYMBOL_GPL(sysfs_create_link); EXPORT_SYMBOL_GPL(sysfs_remove_link); diff -Nru a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h --- a/fs/sysfs/sysfs.h 2004-11-04 16:31:09 -08:00 +++ b/fs/sysfs/sysfs.h 2004-11-04 16:31:09 -08:00 @@ -17,8 +17,6 @@ extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); -extern int sysfs_follow_link(struct dentry *, struct nameidata *); -extern void sysfs_put_link(struct dentry *, struct nameidata *); extern struct rw_semaphore sysfs_rename_sem; extern struct super_block * sysfs_sb; extern struct file_operations sysfs_dir_operations; ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.3, 2004/11/04 10:12:44-08:00, kay.sievers@vrfy.org [PATCH] add the physical device and the bus to the hotplug environment Add the sysfs path of the physical device to the hotplug event of class and block devices. This should solve the userspace issue not to know if the device is a virtual one and the "device" symlink will never be created, but we sit there and wait for it to show up not knowing when we should give up. Also the bus name is added to the hotplug event, so we don't need to reverse lookup in the /sys/bus/* directory which bus our physical device belongs to. This is e.g. the value matched against the BUS= key, that may be used in an udev rule. This is a PCI network card: ACTION=add SUBSYSTEM=net DEVPATH=/class/net/eth0 PHYSDEVPATH=/devices/pci0000:00/0000:00:1e.0/0000:02:01.0 PHYSDEVBUS=pci INTERFACE=eth0 SEQNUM=827 PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/ This is a IDE CDROM: ACTION=add SUBSYSTEM=block DEVPATH=/block/hdc PHYSDEVPATH=/devices/pci0000:00/0000:00:1f.1/ide1/1.0 PHYSDEVBUS=ide SEQNUM=1017 PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/ This is an USB-stick partition: ACTION=add SUBSYSTEM=block DEVPATH=/block/sda/sda1 PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/host1/target1:0:0/1:0:0:0 PHYSDEVBUS=scsi SEQNUM=1032 PATH=/sbin:/bin:/usr/sbin:/usr/bin HOME=/ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> drivers/base/class.c | 26 ++++++++++++++++++++++++++ drivers/block/genhd.c | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff -Nru a/drivers/base/class.c b/drivers/base/class.c --- a/drivers/base/class.c 2004-11-04 16:31:01 -08:00 +++ b/drivers/base/class.c 2004-11-04 16:31:01 -08:00 @@ -283,8 +283,34 @@ { struct class_device *class_dev = to_class_dev(kobj); int retval = 0; + int i = 0; + int length = 0; pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id); + + if (class_dev->dev) { + /* add physical device, backing this device */ + struct device *dev = class_dev->dev; + char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); + + add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, + &length, "PHYSDEVPATH=%s", path); + kfree(path); + + /* add bus name of physical device */ + if (dev->bus) + add_hotplug_env_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVBUS=%s", dev->bus->name); + + /* terminate, set to next free slot, shrink available space */ + envp[i] = NULL; + envp = &envp[i]; + num_envp -= i; + buffer = &buffer[length]; + buffer_size -= length; + } + if (class_dev->class->hotplug) { /* have the bus specific function add its stuff */ retval = class_dev->class->hotplug (class_dev, envp, num_envp, diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c --- a/drivers/block/genhd.c 2004-11-04 16:31:01 -08:00 +++ b/drivers/block/genhd.c 2004-11-04 16:31:01 -08:00 @@ -438,8 +438,46 @@ return ((ktype == &ktype_block) || (ktype == &ktype_part)); } +static int block_hotplug(struct kset *kset, struct kobject *kobj, char **envp, + int num_envp, char *buffer, int buffer_size) +{ + struct device *dev = NULL; + struct kobj_type *ktype = get_ktype(kobj); + int length = 0; + int i = 0; + + /* get physical device backing disk or partition */ + if (ktype == &ktype_block) { + struct gendisk *disk = container_of(kobj, struct gendisk, kobj); + dev = disk->driverfs_dev; + } else if (ktype == &ktype_part) { + struct gendisk *disk = container_of(kobj->parent, struct gendisk, kobj); + dev = disk->driverfs_dev; + } + + if (dev) { + /* add physical device, backing this device */ + char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); + + add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, + &length, "PHYSDEVPATH=%s", path); + kfree(path); + + /* add bus name of physical device */ + if (dev->bus) + add_hotplug_env_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVBUS=%s", dev->bus->name); + + envp[i] = NULL; + } + + return 0; +} + static struct kset_hotplug_ops block_hotplug_ops = { - .filter = block_hotplug_filter, + .filter = block_hotplug_filter, + .hotplug = block_hotplug, }; /* declare block_subsys. */ ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.4, 2004/11/04 10:28:20-08:00, tj@home-tj.org [PATCH] driver-model: comment fix in bus.c df_01_driver_attach_comment_fix.patch bus_match() was renamed to driver_probe_device() but the comment for device_attach() wasn't updated. This patch updates it. Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> drivers/base/bus.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c --- a/drivers/base/bus.c 2004-11-04 16:30:54 -08:00 +++ b/drivers/base/bus.c 2004-11-04 16:30:54 -08:00 @@ -325,10 +325,10 @@ * driver_attach - try to bind driver to devices. * @drv: driver. * - * Walk the list of devices that the bus has on it and try to match - * the driver with each one. - * If bus_match() returns 0 and the @dev->driver is set, we've found - * a compatible pair. + * Walk the list of devices that the bus has on it and try to + * match the driver with each one. If driver_probe_device() + * returns 0 and the @dev->driver is set, we've found a + * compatible pair. * * Note that we ignore the -ENODEV error from driver_probe_device(), * since it's perfectly valid for a driver not to bind to any devices. ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.5, 2004/11/04 10:48:20-08:00, tj@home-tj.org [PATCH] driver-model: bus_recan_devices() locking fix df_02_bus_rescan_devcies_fix.patch bus_rescan_devices() eventually calls device_attach() and thus requires write locking the corresponding bus. The original code just called bus_for_each_dev() which only read locks the bus. This patch separates __bus_for_each_dev() and __bus_for_each_drv(), which don't do locking themselves, out from the original functions and call them with read lock in the original functions and with write lock in bus_rescan_devices(). Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> drivers/base/bus.c | 93 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 56 insertions(+), 37 deletions(-) diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c --- a/drivers/base/bus.c 2004-11-04 16:30:46 -08:00 +++ b/drivers/base/bus.c 2004-11-04 16:30:46 -08:00 @@ -135,6 +135,52 @@ decl_subsys(bus, &ktype_bus, NULL); +static int __bus_for_each_dev(struct bus_type *bus, struct device *start, + void *data, int (*fn)(struct device *, void *)) +{ + struct list_head *head; + struct device *dev; + int error = 0; + + if (!(bus = get_bus(bus))) + return -EINVAL; + + head = &bus->devices.list; + dev = list_prepare_entry(start, head, bus_list); + list_for_each_entry_continue(dev, head, bus_list) { + get_device(dev); + error = fn(dev, data); + put_device(dev); + if (error) + break; + } + put_bus(bus); + return error; +} + +static int __bus_for_each_drv(struct bus_type *bus, struct device_driver *start, + void * data, int (*fn)(struct device_driver *, void *)) +{ + struct list_head *head; + struct device_driver *drv; + int error = 0; + + if (!(bus = get_bus(bus))) + return -EINVAL; + + head = &bus->drivers.list; + drv = list_prepare_entry(start, head, kobj.entry); + list_for_each_entry_continue(drv, head, kobj.entry) { + get_driver(drv); + error = fn(drv, data); + put_driver(drv); + if (error) + break; + } + put_bus(bus); + return error; +} + /** * bus_for_each_dev - device iterator. * @bus: bus type. @@ -154,30 +200,16 @@ * to retain this data, it should do, and increment the reference * count in the supplied callback. */ + int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, int (*fn)(struct device *, void *)) { - struct device *dev; - struct list_head * head; - int error = 0; - - if (!(bus = get_bus(bus))) - return -EINVAL; - - head = &bus->devices.list; - dev = list_prepare_entry(start, head, bus_list); + int ret; down_read(&bus->subsys.rwsem); - list_for_each_entry_continue(dev, head, bus_list) { - get_device(dev); - error = fn(dev, data); - put_device(dev); - if (error) - break; - } + ret = __bus_for_each_dev(bus, start, data, fn); up_read(&bus->subsys.rwsem); - put_bus(bus); - return error; + return ret; } /** @@ -203,27 +235,12 @@ int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, void * data, int (*fn)(struct device_driver *, void *)) { - struct list_head * head; - struct device_driver *drv; - int error = 0; - - if(!(bus = get_bus(bus))) - return -EINVAL; - - head = &bus->drivers.list; - drv = list_prepare_entry(start, head, kobj.entry); + int ret; down_read(&bus->subsys.rwsem); - list_for_each_entry_continue(drv, head, kobj.entry) { - get_driver(drv); - error = fn(drv, data); - put_driver(drv); - if(error) - break; - } + ret = __bus_for_each_drv(bus, start, data, fn); up_read(&bus->subsys.rwsem); - put_bus(bus); - return error; + return ret; } /** @@ -590,7 +607,9 @@ { int count = 0; - bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper); + down_write(&bus->subsys.rwsem); + __bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper); + up_write(&bus->subsys.rwsem); return count; } ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.6, 2004/11/04 10:54:31-08:00, tj@home-tj.org [PATCH] driver-model: sysfs_release() dangling pointer reference fix df_03_sysfs_release_fix.patch Some attributes are allocated dynamically (e.g. module and device parameters) and are usually deallocated when the assoicated kobject is released. So, it's not safe to access attr after putting the kobject. Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> fs/sysfs/file.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) diff -Nru a/fs/sysfs/file.c b/fs/sysfs/file.c --- a/fs/sysfs/file.c 2004-11-04 16:30:39 -08:00 +++ b/fs/sysfs/file.c 2004-11-04 16:30:39 -08:00 @@ -330,11 +330,13 @@ { struct kobject * kobj = to_kobj(filp->f_dentry->d_parent); struct attribute * attr = to_attr(filp->f_dentry); + struct module * owner = attr->owner; struct sysfs_buffer * buffer = filp->private_data; if (kobj) kobject_put(kobj); - module_put(attr->owner); + /* After this point, attr should not be accessed. */ + module_put(owner); if (buffer) { if (buffer->page) ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.7, 2004/11/04 10:55:28-08:00, tj@home-tj.org [PATCH] driver-model: kobject_add() error path reference counting fix df_04_kobject_add_ref_fix.patch In kobject_add(), @kobj wasn't put'd properly on error path. This patch fixes it. Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> lib/kobject.c | 1 + 1 files changed, 1 insertion(+) diff -Nru a/lib/kobject.c b/lib/kobject.c --- a/lib/kobject.c 2004-11-04 16:30:32 -08:00 +++ b/lib/kobject.c 2004-11-04 16:30:32 -08:00 @@ -183,6 +183,7 @@ unlink(kobj); if (parent) kobject_put(parent); + kobject_put(kobj); } else { kobject_hotplug(kobj, KOBJ_ADD); } ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.8, 2004/11/04 10:57:45-08:00, tj@home-tj.org [PATCH] driver-model: device_add() error path reference counting fix df_05_device_add_ref_fix.patch In device_add(), @dev wan't put'd properly when it has zero length bus_id (error path). Fixed. Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> drivers/base/core.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -Nru a/drivers/base/core.c b/drivers/base/core.c --- a/drivers/base/core.c 2004-11-04 16:30:24 -08:00 +++ b/drivers/base/core.c 2004-11-04 16:30:24 -08:00 @@ -209,12 +209,12 @@ */ int device_add(struct device *dev) { - struct device * parent; - int error; + struct device *parent = NULL; + int error = -EINVAL; dev = get_device(dev); if (!dev || !strlen(dev->bus_id)) - return -EINVAL; + goto Error; parent = get_device(dev->parent); ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.9, 2004/11/04 11:59:39-08:00, greg@kroah.com kevent: fix build error if CONFIG_KOBJECT_UEVENT is not selected. Thanks to Serge Hallyn <serue@us.ibm.com> for pointing this out. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> lib/kobject_uevent.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c --- a/lib/kobject_uevent.c 2004-11-04 16:30:17 -08:00 +++ b/lib/kobject_uevent.c 2004-11-04 16:30:17 -08:00 @@ -168,7 +168,7 @@ #else static inline int send_uevent(const char *signal, const char *obj, - const void *buf, int buflen, int gfp_mask) + char **envp, int gfp_mask) { return 0; } ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.10, 2004/11/04 12:00:12-08:00, rml@novell.com [PATCH] kobject_uevent: fix init ordering Looks like kobject_uevent_init is executed before netlink_proto_init and consequently always fails. Not cool. Attached patch switches the initialization over from core_initcall (init level 1) to postcore_initcall (init level 2). Netlink's initialization is done in core_initcall, so this should fix the problem. We should be fine waiting until postcore_initcall. Also a couple white space changes mixed in, because I am anal. Signed-Off-By: Robert Love <rml@novell.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> lib/kobject_uevent.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c --- a/lib/kobject_uevent.c 2004-11-04 16:30:09 -08:00 +++ b/lib/kobject_uevent.c 2004-11-04 16:30:09 -08:00 @@ -120,9 +120,8 @@ sprintf(attrpath, "%s/%s", path, attr->name); rc = send_uevent(signal, attrpath, NULL, gfp_mask); kfree(attrpath); - } else { + } else rc = send_uevent(signal, path, NULL, gfp_mask); - } exit: kfree(path); @@ -148,7 +147,6 @@ { return do_kobject_uevent(kobj, action, attr, GFP_ATOMIC); } - EXPORT_SYMBOL_GPL(kobject_uevent_atomic); static int __init kobject_uevent_init(void) @@ -164,7 +162,7 @@ return 0; } -core_initcall(kobject_uevent_init); +postcore_initcall(kobject_uevent_init); #else static inline int send_uevent(const char *signal, const char *obj, ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 2004-11-05 0:48 ` Greg KH 0 siblings, 1 reply; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2449.2.11, 2004/11/04 12:00:36-08:00, rml@novell.com [PATCH] kobject_uevent: add MAINTAINER entry Attached patch adds a MAINTAINER entry for the kernel event layer. Signed-Off-By: Robert Love <rml@novell.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> MAINTAINERS | 6 ++++++ 1 files changed, 6 insertions(+) diff -Nru a/MAINTAINERS b/MAINTAINERS --- a/MAINTAINERS 2004-11-04 16:30:02 -08:00 +++ b/MAINTAINERS 2004-11-04 16:30:02 -08:00 @@ -1247,6 +1247,12 @@ W: http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/ S: Maintained +KERNEL EVENT LAYER (KOBJECT_UEVENT) +P: Robert Love +M: rml@novell.com +L: linux-kernel@vger.kernel.org +S: Maintained + LANMEDIA WAN CARD DRIVER P: Andrew Stanley-Jones M: asj@lanmedia.com ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] More Driver Core patches for 2.6.10-rc1 2004-11-05 0:48 ` Greg KH @ 2004-11-05 0:48 ` Greg KH 0 siblings, 0 replies; 25+ messages in thread From: Greg KH @ 2004-11-05 0:48 UTC (permalink / raw) To: linux-kernel ChangeSet 1.2462, 2004/11/04 14:44:35-08:00, maneesh@in.ibm.com [PATCH] fix kernel BUG at fs/sysfs/dir.c:20! On Thu, Nov 04, 2004 at 12:52:38PM -0800, Greg KH wrote: > Hi, > > I get the following BUG in the sysfs code when I do: > - plug in a usb-serial device. > - open the port with 'cat /dev/ttyUSB0' > - unplug the device. > - stop the 'cat' process with control-C > > This used to work just fine before your big sysfs changes. There is a similar problem reported by s390 people where we see parent kobject (directory) going away before child kobject (sub-directory). It seems kobject code is able to handle this, but not the sysfs. What could be happening that in sysfs_remove_dir() of parent directory, we try to remove its contents. It works well with the regular files as it is the final removal for sysfs_dirent corresponding to the files. But in case of sub-directory we are doing an extra sysfs_put(). Once while removing parent and the other one being the one from when sysfs_remove_dir() is called for the child. The following patch worked for the s390 people, I hope same will work in this case also. o Do not remove sysfs_dirents corresponding to the sub-directory in sysfs_remove_dir(). They will be removed in the sysfs_remove_dir() call for the specific sub-directory. Signed-off-by: Maneesh Soni <maneesh@in.ibm.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com> fs/sysfs/dir.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c --- a/fs/sysfs/dir.c 2004-11-04 16:29:54 -08:00 +++ b/fs/sysfs/dir.c 2004-11-04 16:29:54 -08:00 @@ -277,7 +277,7 @@ pr_debug("sysfs %s: removing dir\n",dentry->d_name.name); down(&dentry->d_inode->i_sem); list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { - if (!sd->s_element) + if (!sd->s_element || !(sd->s_type & SYSFS_NOT_PINNED)) continue; list_del_init(&sd->s_sibling); sysfs_drop_dentry(sd, dentry); ^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2004-11-13 21:15 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-12 22:58 [BK PATCH] More Driver Core patches for 2.6.10-rc1 Greg KH
2004-11-12 23:00 ` [PATCH] " Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
[not found] ` <20041113000052.GC346@electric-eye.fr.zoreil.com>
[not found] ` <200411130020.17494.lists@kenneth.aafloy.net>
2004-11-13 0:44 ` Greg KH
2004-11-13 20:51 ` [BK PATCH] " Linus Torvalds
2004-11-13 21:10 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2004-11-05 0:35 [BK PATCH] More USB " Greg KH
2004-11-05 0:48 ` [PATCH] More Driver Core " Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).