driver core patches for 2.6.30-git
Subsystems (60)
PATCH 1/1 driver core patches for 2.6.30-git
Here is the big patch series for the driver core for your tree.
It's just lots of little things, cleanups of apis, and documentation, and other minor stuff. Most of the cleanups are being done for future changes to the driver core, to prevent us from having to touch code outside of it.
There are also some debugfs updates as well.
All of the non-driver-core touching patches have been sent to the various subsystem maintainers and gotten acks for them.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git/
All of these patches have been in the linux-next and mm trees for a while.
The patches will be sent as a follow-on to this message to lkml for people to see.
thanks,
greg k-h
------------
Documentation/DocBook/debugobjects.tmpl | 2 +- Documentation/cdrom/packet-writing.txt | 2 +- Documentation/driver-model/device.txt | 32 +++ Documentation/fault-injection/fault-injection.txt | 70 +++--- Documentation/firmware_class/README | 3 +- Documentation/kprobes.txt | 6 +- Documentation/trace/ftrace.txt | 233 ++++++++++++-------- Documentation/trace/mmiotrace.txt | 26 +- arch/mips/sni/eisa.c | 2 +- arch/um/drivers/net_kern.c | 4 +- arch/um/drivers/ubd_kern.c | 4 +- arch/x86/kernel/cpuid.c | 6 + arch/x86/kernel/microcode_core.c | 1 + arch/x86/kernel/msr.c | 6 + block/bsg.c | 6 + block/genhd.c | 10 + drivers/base/core.c | 57 +++++- drivers/base/dd.c | 6 +- drivers/base/firmware_class.c | 27 ++- drivers/base/platform.c | 7 +- drivers/base/sys.c | 8 +- drivers/block/aoe/aoechr.c | 7 + drivers/block/pktcdvd.c | 9 +- drivers/block/ps3disk.c | 18 +- drivers/block/ps3vram.c | 46 ++-- drivers/block/xen-blkfront.c | 14 +- drivers/char/hvcs.c | 6 +- drivers/char/hw_random/core.c | 1 + drivers/char/ipmi/ipmi_si_intf.c | 4 +- drivers/char/misc.c | 15 +- drivers/char/raw.c | 6 + drivers/eisa/pci_eisa.c | 2 +- drivers/eisa/virtual_root.c | 2 +- drivers/firewire/fw-sbp2.c | 6 +- drivers/gpu/drm/drm_debugfs.c | 12 +- drivers/gpu/drm/drm_drv.c | 2 +- drivers/gpu/drm/drm_stub.c | 2 +- drivers/gpu/drm/drm_sysfs.c | 7 + drivers/hid/usbhid/hiddev.c | 7 +- drivers/ide/ide-pm.c | 6 +- drivers/ide/ide-probe.c | 4 +- drivers/ide/ide_platform.c | 2 +- drivers/ieee1394/eth1394.c | 16 +- drivers/ieee1394/sbp2.c | 8 +- drivers/infiniband/core/sysfs.c | 2 +- drivers/infiniband/hw/ehca/ehca_main.c | 8 +- drivers/input/input.c | 6 + drivers/input/touchscreen/wm97xx-core.c | 2 +- drivers/input/xen-kbdfront.c | 8 +- drivers/md/dm-ioctl.c | 1 + drivers/media/common/tuners/tuner-xc2028.c | 2 +- drivers/media/dvb/dvb-core/dvbdev.c | 10 + drivers/media/dvb/dvb-usb/dvb-usb.h | 2 +- drivers/media/dvb/firewire/firedtv-1394.c | 4 +- drivers/media/dvb/firewire/firedtv-dvb.c | 2 +- drivers/media/video/dabusb.c | 6 + drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 22 +- drivers/mfd/htc-pasic3.c | 4 +- drivers/mfd/pcf50633-core.c | 2 +- drivers/mfd/wm8400-core.c | 2 +- drivers/net/Kconfig | 4 +- drivers/net/tun.c | 1 + drivers/net/wimax/i2400m/i2400m.h | 2 +- drivers/net/wireless/ath/ath5k/Kconfig | 5 +- drivers/net/wireless/libertas/README | 12 +- drivers/net/wireless/libertas/if_spi.c | 8 +- drivers/net/wireless/libertas/if_spi.h | 3 + drivers/net/wireless/libertas/if_usb.c | 8 +- drivers/net/xen-netfront.c | 10 +- drivers/parisc/eisa.c | 2 +- drivers/parisc/sba_iommu.c | 6 +- drivers/parport/parport_gsc.c | 4 +- drivers/pci/pcie/portdrv_core.c | 2 +- drivers/pcmcia/ds.c | 20 +-- drivers/s390/char/con3215.c | 16 +- drivers/s390/char/raw3270.c | 16 +- drivers/s390/char/tape_34xx.c | 2 +- drivers/s390/char/tape_3590.c | 2 +- drivers/s390/char/tape_core.c | 22 +- drivers/s390/char/vmlogrdr.c | 12 +- drivers/s390/char/vmur.c | 16 +- drivers/s390/net/claw.c | 52 +++--- drivers/s390/net/lcs.c | 20 +- drivers/s390/net/lcs.h | 4 +- drivers/s390/net/netiucv.c | 47 ++-- drivers/scsi/aha1740.c | 2 +- drivers/scsi/ibmvscsi/ibmvscsi.c | 6 +- drivers/scsi/ibmvscsi/ibmvstgt.c | 2 +- drivers/scsi/libsrp.c | 2 +- drivers/scsi/lpfc/lpfc_debugfs.c | 3 +- drivers/serial/of_serial.c | 4 +- drivers/thermal/thermal_sys.c | 4 +- drivers/usb/atm/ueagle-atm.c | 9 +- drivers/usb/class/usblp.c | 6 + drivers/usb/core/file.c | 13 +- drivers/usb/core/usb.c | 11 + drivers/usb/gadget/at91_udc.c | 6 +- drivers/usb/misc/iowarrior.c | 6 + drivers/usb/misc/legousbtower.c | 6 + drivers/video/xen-fbfront.c | 8 +- fs/debugfs/file.c | 65 ++++++- fs/debugfs/inode.c | 11 + fs/sysfs/symlink.c | 5 +- include/linux/device.h | 5 + include/linux/eisa.h | 4 +- include/linux/firmware.h | 1 - include/linux/genhd.h | 2 +- include/linux/kernel.h | 2 +- include/linux/miscdevice.h | 1 + include/linux/platform_device.h | 4 +- include/linux/sched.h | 2 +- include/linux/tracepoint.h | 4 +- include/linux/usb.h | 3 + init/Kconfig | 6 +- kernel/trace/Kconfig | 10 +- kernel/trace/trace.c | 23 +- kernel/user.c | 67 ++++--- lib/kobject.c | 7 +- samples/Kconfig | 3 +- samples/firmware_class/firmware_sample_driver.c | 121 ---------- .../firmware_sample_firmware_class.c | 204 ----------------- scripts/tracing/draw_functrace.py | 7 +- sound/sound_core.c | 7 + 123 files changed, 907 insertions(+), 844 deletions(-) delete mode 100644 samples/firmware_class/firmware_sample_driver.c delete mode 100644 samples/firmware_class/firmware_sample_firmware_class.c
---------------
Armin Kuster (1):
Sysfs: fix possible memleak in sysfs_follow_link
Dave Young (2):
kobject: make kset_create check kobject_set_name return value
driver-core: make sysdev_class_register check kobject_set_name return value
Dmitry Torokhov (1):
Driver core: fix comment for device_attach()
GeunSik Lim (1):
debugfs: Fix terminology inconsistency of dir name to mount debugfs filesystem.
Grant Likely (1):
Driver Core: Warn driver authors about adding device attributes
Greg Kroah-Hartman (27):
firmware: remove broken example files
driver core: fix gcc 4.3.3 warnings about string literals
eisa: remove driver_data direct access of struct device
firewire: remove driver_data direct access of struct device
ide: remove driver_data direct access of struct device
ieee1394: remove driver_data direct access of struct device
infiniband: remove driver_data direct access of struct device
input: remove driver_data direct access of struct device
media: remove driver_data direct access of struct device
mfd: remove driver_data direct access of struct device
PCIE: remove driver_data direct access of struct device
pcmcia: remove driver_data direct access of struct device
scsi: remove driver_data direct access of struct device
thermal: remove driver_data direct access of struct device
xen block: remove driver_data direct access of struct device
hvcs: remove driver_data direct access of struct device
ibmvscsi: gadget: at91_udc: remove driver_data direct access of struct device
infiniband: ehca: remove driver_data direct access of struct device
ipmi: remove driver_data direct access of struct device
mips: remove driver_data direct access of struct device
of_serial: remove driver_data direct access of struct device
parisc: remove driver_data direct access of struct device
parport: remove driver_data direct access of struct device
s390: remove driver_data direct access of struct device
uml: remove driver_data direct access of struct device
usb: gadget: at91_udc: remove driver_data direct access of struct device
xen: remove driver_data direct access of struct device from more drivers
Joerg Roedel (1):
driver core: add BUS_NOTIFY_UNBOUND_DRIVER event
John W. Linville (1):
firmware: wireless/libertas: prepare for FIRMWARE_NAME_MAX removal
Jonathan Corbet (1):
debugfs: fix docbook error
Kay Sievers (14):
driver core: set default SYSFS_DEPRECATED=n
sched: delayed cleanup of user_struct
Driver Core: add nodename callbacks
Driver Core: misc: add nodename support for misc devices. Driver Core: usb: add nodename support for usb drivers. Driver Core: block: add nodename support for block drivers. Driver Core: x86: add nodename for cpuid and msr drivers. Driver Core: dvb: add nodename for dvb drivers Driver Core: input: add nodename for input drivers Driver Core: sound: add nodename for sound drivers Driver Core: raw: add nodename for raw devices Driver Core: drm: add nodename for drm devices Driver Core: aoe: add nodename for aoe devices Driver Core: bsg: add nodename for bsg driver
Linus Walleij (1):
driver core: Const-correct platform getbyname functions
Michal Marek (1):
kobject: samples: make SAMPLE_KOBJECT module-only
Ming Lei (2):
driver core: firmware_class: replace kfree(dev) with put_device(dev) driver core: fix documentation of request_firmware_nowait
Robin Getz (1):
debugfs: use specified mode to possibly mark files read/write only
Roel Kluin (1):
block/ps3: remove driver_data direct access of struct device
Samuel Ortiz (6):
firmware: allocate firmware id dynamically
firmware: atm/ueagle-atm: prepare for FIRMWARE_NAME_MAX removal
firmware: tuners/xc2028: prepare for FIRMWARE_NAME_MAX removal
firmware: dvb/dvb-usb: prepare for FIRMWARE_NAME_MAX removal
firmware: pcmcia/ds: prepare for FIRMWARE_NAME_MAX removal
firmware: FIRMWARE_NAME_MAX removal
Shaohua Li (1):
driver core: synchronize device shutdown
Steven Rostedt (1):
debugfs: dont stop on first failed recursive delete
PATCH 1/64 driver core: set default SYSFS_DEPRECATED=n
From: Kay Sievers <[email protected]>
All recent distros depend on the non-deprecated sysfs layout, so change the default value of the option to reflect that.
--- init/Kconfig | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
init/Kconfig +3 -3
@@ -616,13 +616,13 @@ config SYSFS_DEPRECATED bool config SYSFS_DEPRECATED_V2 - bool "Create deprecated sysfs layout for older userspace tools" + bool "remove sysfs features which may confuse old userspace tools" depends on SYSFS - default y + default n select SYSFS_DEPRECATED help This option switches the layout of sysfs to the deprecated - version. + version. Do not use it on recent distributions. The current sysfs layout features a unified device tree at /sys/devices/, which is able to express a hierarchy between
Signature · 1 line
1.6.3.2
Re: [PATCH 01/64] driver core: set default SYSFS_DEPRECATED=n
Hi!
Quoted 14 lines
All recent distros depend on the non-deprecated sysfs layout, so change the default value of the option to reflect that.
Signed-off-by Kay Sievers <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- init/Kconfig | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)init/Kconfig +0
-0
init/Kconfig config SYSFS_DEPRECATED · line 619
Quoted 5 lines
init/Kconfig +1
-1@@ -616,13 +616,13 @@ config SYSFS_DEPRECATED bool config SYSFS_DEPRECATED_V2 - bool "Create deprecated sysfs layout for older userspace tools" + bool "remove sysfs features which may confuse old userspace tools"
Should begin with capital letter. What is worse, this inverts sense of description text, but you did not change semantics of the option.
init/Kconfig config SYSFS_DEPRECATED · line 625
Quoted 8 lines
init/Kconfig +2
-2depends on SYSFS - default y + default n select SYSFS_DEPRECATED help This option switches the layout of sysfs to the deprecated - version. + version. Do not use it on recent distributions.
Recent is relative. 'On distros from 2008 and onwards'?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 2/64 sched: delayed cleanup of user_struct
In reply to Greg KHFrom: Kay Sievers <[email protected]>
During bootup performance tracing we see repeated occurrences of /sys/kernel/uid/* events for the same uid, leading to a, in this case, rather pointless userspace processing for the same uid over and over.
This is usually caused by tools which change their uid to "nobody", to run without privileges to read data supplied by untrusted users.
This change delays the execution of the (already existing) scheduled work, to cleanup the uid after one second, so the allocated and announced uid can possibly be re-used by another process.
This is the current behavior, where almost every invocation of a binary, which changes the uid, creates two events:
$ read START < /sys/kernel/uevent_seqnum; \ for i in `seq 100`; do su --shell=/bin/true bin; done; \ read END < /sys/kernel/uevent_seqnum; \ echo $(($END - $START)) 178
With the delayed cleanup, we get only two events, and userspace finishes a bit faster too:
$ read START < /sys/kernel/uevent_seqnum; \ for i in `seq 100`; do su --shell=/bin/true bin; done; \ read END < /sys/kernel/uevent_seqnum; \ echo $(($END - $START)) 1
--- include/linux/sched.h | 2 +- kernel/user.c | 67 ++++++++++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 29 deletions(-)
include/linux/sched.h +1 -1
@@ -674,7 +674,7 @@ struct user_struct {struct task_group *tg;#ifdef CONFIG_SYSFS struct kobject kobj; -struct work_struct work; +struct delayed_work work;#endif #endif
kernel/user.c +39 -28
109 lines not on this page · raw message
Signature · 1 line
1.6.3.2
PATCH 3/64 Driver Core: Warn driver authors about adding device attributes
In reply to Greg KHFrom: Grant Likely <[email protected]>
Add a blurb to the driver-model documentation about how (not) to add extra attributes to a struct device at driver probe time.
--- Documentation/driver-model/device.txt | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-)
Documentation/driver-model/device.txt +32 -0
@@ -162,3 +162,35 @@ device_remove_file(dev,&dev_attr_power); The file name will be 'power' with a mode of 0644 (-rw-r--r--). +Word of warning: While the kernel allows device_create_file() and +device_remove_file() to be called on a device at any time, userspace has +strict expectations on when attributes get created. When a new device is +registered in the kernel, a uevent is generated to notify userspace (like +udev) that a new device is available. If attributes are added after the +device is registered, then userspace won't get notified and userspace will +not know about the new attributes. + +This is important for device driver that need to publish additional +attributes for a device at driver probe time. If the device driver simply +calls device_create_file() on the device structure passed to it, then +userspace will never be notified of the new attributes. Instead, it should +probably use class_create() and class->dev_attrs to set up a list of +desired attributes in the modules_init function, and then in the .probe() +hook, and then use device_create() to create a new device as a child +of the probed device. The new device will generate a new uevent and +properly advertise the new attributes to userspace. + +For example, if a driver wanted to add the following attributes: +struct device_attribute mydriver_attribs[] = { + __ATTR(port_count, 0444, port_count_show), + __ATTR(serial_number, 0444, serial_number_show), + NULL +}; + +Then in the module init function is would do: + mydriver_class = class_create(THIS_MODULE, "my_attrs"); + mydriver_class.dev_attr = mydriver_attribs; + +And assuming 'dev' is the struct device passed into the probe hook, the driver +probe function would do something like: + create_device(&mydriver_class, dev, chrdev, &private_data, "my_name");
Signature · 1 line
1.6.3.2
PATCH 4/64 Sysfs: fix possible memleak in sysfs_follow_link
In reply to Greg KHFrom: Armin Kuster <[email protected]>
There is the possiblity of a memory leak if a page is allocated and if sysfs_getlink() fails in the sysfs_follow_link.
--- fs/sysfs/symlink.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
fs/sysfs/symlink.c +4 -1
@@ -192,8 +192,11 @@ static void *sysfs_follow_link(struct dentry *dentry, struct nameidata *nd) {int error = -ENOMEM ;unsigned long page =get_zeroed_page (GFP_KERNEL ); -if (page) +if (page) { error =sysfs_getlink (dentry, (char *) page); +if (error <0 ) +free_page ((unsigned long )page); + }nd_set_link (nd, error ?ERR_PTR (error) : (char *)page);return NULL ; }
Signature · 1 line
1.6.3.2
PATCH 5/64 driver core: firmware_class: replace kfree(dev) with put_device(dev)
In reply to Greg KHFrom: Ming Lei <[email protected]>
against v2.6.30-rc3-next tree.
--- drivers/base/firmware_class.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/base/firmware_class.c +5 -3
@@ -356,7 +356,7 @@ static void fw_dev_release(struct device *dev)__free_page (fw_priv->pages[i]);kfree (fw_priv->pages);kfree (fw_priv); -kfree (dev); +put_device (dev);module_put (THIS_MODULE ); }
@@ -400,14 +400,16 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, retval =device_register (f_dev);if (retval) {dev_err (device,"%s: device_register failed\n" , __func__); - goto error_kfree; +put_device (f_dev); + goto error_kfree1; } *dev_p = f_dev;return 0 ; error_kfree: -kfree (fw_priv);kfree (f_dev); +error_kfree1: +kfree (fw_priv);return retval; }
Signature · 1 line
1.6.3.2
PATCH 6/64 driver core: add BUS_NOTIFY_UNBOUND_DRIVER event
In reply to Greg KHFrom: Joerg Roedel <[email protected]>
This patch adds a new bus notifier event which is emitted _after_ a device is removed from its driver. This event will be used by the dma-api debug code to check if a driver has released all dma allocations for that device.
--- drivers/base/dd.c | 4 ++++ include/linux/device.h | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/base/dd.c +4 -0
@@ -320,6 +320,10 @@ static void __device_release_driver(struct device *dev)devres_release_all (dev); dev->driver =NULL ;klist_remove (&dev->p->knode_driver); +if (dev->bus) +blocking_notifier_call_chain (&dev->bus->p->bus_notifier, +BUS_NOTIFY_UNBOUND_DRIVER , + dev); } }
include/linux/device.h +2 -0
@@ -114,6 +114,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,#define BUS_NOTIFY_BOUND_DRIVER 0x00000003/* driver bound to device */ #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004/* driver about to be unbound */ +#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005/* driver is unbound +from the device */ extern struct kset *bus_get_kset (struct bus_type *bus);extern struct klist *bus_get_device_klist (struct bus_type *bus);
Signature · 1 line
1.6.3.2
PATCH 7/64 driver core: Const-correct platform getbyname functions
In reply to Greg KHFrom: Linus Walleij <[email protected]>
This converts resource and IRQ getbyname functions for the platform bus to use const char *, I ran into compiler moanings when I tried using a const char * for looking up a certain resource.
--- drivers/base/platform.c | 5 +++-- include/linux/platform_device.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/base/platform.c +3 -2
@@ -69,7 +69,8 @@ EXPORT_SYMBOL_GPL(platform_get_irq);* @name: resource name */ struct resource *platform_get_resource_byname (struct platform_device *dev, -unsigned int type,char *name) +unsigned int type, +const char *name) {int i;
@@ -88,7 +89,7 @@ EXPORT_SYMBOL_GPL(platform_get_resource_byname);* @dev: platform device * @name: IRQ name */ -int platform_get_irq_byname (struct platform_device *dev,char *name) +int platform_get_irq_byname (struct platform_device *dev,const char *name) {struct resource *r =platform_get_resource_byname (dev,IORESOURCE_IRQ , name);
include/linux/platform_device.h +2 -2
@@ -36,8 +36,8 @@ extern struct device platform_bus;extern struct resource *platform_get_resource (struct platform_device *,unsigned int ,unsigned int );extern int platform_get_irq (struct platform_device *,unsigned int ); -extern struct resource *platform_get_resource_byname (struct platform_device *,unsigned int ,char *); -extern int platform_get_irq_byname (struct platform_device *,char *); +extern struct resource *platform_get_resource_byname (struct platform_device *,unsigned int ,const char *); +extern int platform_get_irq_byname (struct platform_device *,const char *);extern int platform_add_devices (struct platform_device **,int ); extern struct platform_device *platform_device_register_simple(const char *, int id,
Signature · 1 line
1.6.3.2
PATCH 8/64 debugfs: dont stop on first failed recursive delete
In reply to Greg KHFrom: Steven Rostedt <[email protected]>
debugfs: dont stop on first failed recursive delete
While running a while loop of removing a module that removes a debugfs directory with debugfs_remove_recursive, and at the same time doing a while loop of cat of a file in that directory, I would hit a point where somehow the cat of the file caused the remove to fail.
The result is that other files did not get removed when the module was removed. I simple read of one of those file can oops the kernel because the operations to the file no longer exist (removed by module).
The funny thing is that the file being cat'ed was removed. It was the siblings that were not. I see in the code to debugfs_remove_recursive there's a test that checks if the child fails to bail out of the loop to prevent an infinite loop.
What this patch does is to still try any siblings in that directory. If all the siblings fail, or there are no more siblings, then we exit the loop.
This fixes the above symptom, but...
This is no full proof. It makes the debugfs_remove_recursive a bit more robust, but it does not explain why the one file failed. There may be some kind of delay deletion that makes the debugfs think it did not succeed. So this patch is more of a fix for the symptom but not the disease.
This patch still makes the debugfs_remove_recursive more robust and until I can find out why the bug exists, this patch will keep the kernel from oopsing in most cases. Even after the cause is found I think this change can stand on its own and should be kept.
[ Impact: prevent kernel oops on module unload and reading debugfs files ]
--- fs/debugfs/inode.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
fs/debugfs/inode.c +11 -0
@@ -403,6 +403,7 @@ void debugfs_remove_recursive(struct dentry *dentry) } child = list_entry(parent->d_subdirs.next, struct dentry, d_u.d_child); + next_sibling:/* * If "child" isn't empty, walk down the tree and
@@ -417,6 +418,16 @@ void debugfs_remove_recursive(struct dentry *dentry)__debugfs_remove (child, parent);if (parent->d_subdirs.next == &child->d_u.d_child) {/* +* Try the next sibling. +*/ +if (child->d_u.d_child.next != &parent->d_subdirs) { + child =list_entry (child->d_u.d_child.next, + struct dentry, + d_u.d_child); + goto next_sibling; + } + +/* * Avoid infinite loop if we fail to remove * one dentry. */
Signature · 1 line
1.6.3.2
PATCH 9/64 Driver core: fix comment for device_attach()
In reply to Greg KHFrom: Dmitry Torokhov <[email protected]>
We are looking for matching drivers, not devices.
--- drivers/base/dd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/base/dd.c +1 -1
@@ -226,7 +226,7 @@ static int __device_attach(struct device_driver *drv, void *data)* pair is found, break out and return. * * Returns 1 if the device was bound to a driver; -* 0 if no matching device was found; +* 0 if no matching driver was found; * -ENODEV if the device is not registered. * * When called for a USB interface, @dev->parent->sem must be held.
Signature · 1 line
1.6.3.2
PATCH 10/64 kobject: make kset_create check kobject_set_name return value
In reply to Greg KHFrom: Dave Young <[email protected]>
kset_create should check the kobject_set_name return value.
Add the return value checking code.
--- lib/kobject.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
lib/kobject.c +6 -1
@@ -793,11 +793,16 @@ static struct kset *kset_create(const char *name, struct kobject *parent_kobj) {struct kset *kset; +int retval; kset =kzalloc (sizeof (*kset),GFP_KERNEL );if (!kset)return NULL ; -kobject_set_name (&kset->kobj, name); + retval =kobject_set_name (&kset->kobj, name); +if (retval) { +kfree (kset); +return NULL ; + } kset->uevent_ops = uevent_ops; kset->kobj.parent = parent_kobj;
Signature · 1 line
1.6.3.2
PATCH 11/64 driver-core: make sysdev_class_register check kobject_set_name return value
In reply to Greg KHFrom: Dave Young <[email protected]>
sysdev_class_register should check the kobject_set_name return value.
Add the return value checking code.
--- drivers/base/sys.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/base/sys.c +7 -1
@@ -131,6 +131,8 @@ static struct kset *system_kset;int sysdev_class_register (struct sysdev_class *cls) { +int retval; +pr_debug ("Registering sysdev class '%s'\n" , cls->name);INIT_LIST_HEAD (&cls->drivers);
@@ -138,7 +140,11 @@ int sysdev_class_register(struct sysdev_class *cls) cls->kset.kobj.parent = &system_kset->kobj; cls->kset.kobj.ktype = &ktype_sysdev_class; cls->kset.kobj.kset = system_kset; -kobject_set_name (&cls->kset.kobj, cls->name); + + retval =kobject_set_name (&cls->kset.kobj, cls->name); +if (retval) +return retval; +return kset_register (&cls->kset); }
Signature · 1 line
1.6.3.2
PATCH 12/64 debugfs: fix docbook error
In reply to Greg KHFrom: Jonathan Corbet <[email protected]>
Fix an error in debugfs_create_blob's docbook description
It cannot actually be used to write a binary blob.
--- fs/debugfs/file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/debugfs/file.c +1 -1
@@ -419,7 +419,7 @@ static const struct file_operations fops_blob = { };/** -* debugfs_create_blob - create a debugfs file that is used to read and write a binary blob +* debugfs_create_blob - create a debugfs file that is used to read a binary blob * @name: a pointer to a string containing the name of the file to create. * @mode: the permission that the file should have * @parent: a pointer to the parent dentry for this file. This should be a
Signature · 1 line
1.6.3.2
PATCH 13/64 driver core: synchronize device shutdown
In reply to Greg KHFrom: Shaohua Li <[email protected]>
A patch series to make .shutdown execute asynchronously. Some drivers's shutdown can take a lot of time. The patches can help save some shutdown time. The patches use Arjan's async API.
This patch:
synchronize all tasks submitted by .shutdown
--- drivers/base/core.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/base/core.c +2 -0
@@ -22,6 +22,7 @@#include <linux/kallsyms.h> #include <linux/semaphore.h> #include <linux/mutex.h> +#include <linux/async.h> #include "base.h" #include "power/power.h"
@@ -1665,4 +1666,5 @@ void device_shutdown(void)kobject_put (sysfs_dev_char_kobj);kobject_put (sysfs_dev_block_kobj);kobject_put (dev_kobj); +async_synchronize_full (); }
Signature · 1 line
1.6.3.2
PATCH 14/64 kobject: samples: make SAMPLE_KOBJECT module-only
In reply to Greg KHFrom: Michal Marek <[email protected]>
With SAMPLE_KOBJECT=y, it isn't even linked into the kernel image.
--- samples/Kconfig | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
samples/Kconfig +2 -1
@@ -26,7 +26,8 @@ config SAMPLE_TRACE_EVENTS This build trace event example modules. config SAMPLE_KOBJECT - tristate "Build kobject examples" + tristate "Build kobject examples -- loadable modules only" + depends on m help This config option will allow you to build a number of different kobject sample modules showing how to use kobjects,
Signature · 1 line
1.6.3.2
PATCH 15/64 driver core: fix documentation of request_firmware_nowait
In reply to Greg KHFrom: Ming Lei <[email protected]>
request_firmware_nowait declares it can be called in non-sleep contexts, but kthead_run called by request_firmware_nowait may sleep. So fix its documentation and comment to make callers clear about it.
--- Documentation/firmware_class/README | 3 ++- drivers/base/firmware_class.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)
Documentation/firmware_class/README +2 -1
@@ -77,7 +77,8 @@ seconds for the whole load operation. - request_firmware_nowait() is also provided for convenience in - non-user contexts. + user contexts to request firmware asynchronously, but can't be called + in atomic contexts. about in-kernel persistence:
drivers/base/firmware_class.c +3 -2
@@ -617,8 +617,9 @@ request_firmware_work_func(void *arg)* @cont: function will be called asynchronously when the firmware * request is over. * -* Asynchronous variant of request_firmware() for contexts where -* it is not possible to sleep. +* Asynchronous variant of request_firmware() for user contexts where +* it is not possible to sleep for long time. It can't be called +* in atomic contexts. **/ int request_firmware_nowait(
Signature · 1 line
1.6.3.2
PATCH 16/64 firmware: allocate firmware id dynamically
In reply to Greg KHFrom: Samuel Ortiz <[email protected]>
The firmware loader has a statically allocated 30 bytes long string for the firmware id (a.k.a. the firmware file name). There is no reason why we couldnt allocate it dynamically, and avoid having restrictions on the firmware names lengths.
--- drivers/base/firmware_class.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/base/firmware_class.c +12 -4
@@ -40,7 +40,7 @@ static int loading_timeout = 60; /* In seconds */static DEFINE_MUTEX (fw_lock);struct firmware_priv { -char fw_id[FIRMWARE_NAME_MAX ]; +char *fw_id;struct completion completion;struct bin_attribute attr_data;struct firmware *fw;
@@ -355,6 +355,7 @@ static void fw_dev_release(struct device *dev)for (i =0 ; i < fw_priv->nr_pages; i++)__free_page (fw_priv->pages[i]);kfree (fw_priv->pages); +kfree (fw_priv->fw_id);kfree (fw_priv);put_device (dev);
@@ -386,7 +387,13 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,init_completion (&fw_priv->completion); fw_priv->attr_data = firmware_attr_data_tmpl; -strlcpy (fw_priv->fw_id, fw_name,FIRMWARE_NAME_MAX ); + fw_priv->fw_id =kstrdup (fw_name,GFP_KERNEL ); +if (!fw_priv->fw_id) { +dev_err (device,"%s: Firmware name allocation failed\n" , + __func__); + retval = -ENOMEM ; + goto error_kfree; + } fw_priv->timeout.function = firmware_class_timeout; fw_priv->timeout.data = (u_long ) fw_priv;
@@ -401,14 +408,15 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,if (retval) {dev_err (device,"%s: device_register failed\n" , __func__);put_device (f_dev); - goto error_kfree1; + goto error_kfree_fw_id; } *dev_p = f_dev;return 0 ; +error_kfree_fw_id: +kfree (fw_priv->fw_id); error_kfree:kfree (f_dev); -error_kfree1:kfree (fw_priv);return retval; }
Signature · 1 line
1.6.3.2
PATCH 17/64 firmware: atm/ueagle-atm: prepare for FIRMWARE_NAME_MAX removal
In reply to Greg KHFrom: Samuel Ortiz <[email protected]>
We're going to remove the FIRMWARE_NAME_MAX definition in order to avoid any firmware name length restriction.
This patch replaces the shared FIRMWARE_NAME_MAX definition with a ueagle local one.
--- drivers/usb/atm/ueagle-atm.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/usb/atm/ueagle-atm.c +5 -4
@@ -306,6 +306,7 @@ enum {#define FW_GET_BYTE (p) *((__u8 *) (p))#define FW_DIR "ueagle-atm/" +#define UEA_FW_NAME_MAX 30#define NB_MODEM 4#define BULK_TIMEOUT 300
@@ -1564,9 +1565,9 @@ static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver) file = cmv_file[sc->modem_index];strcpy (cmv_name,FW_DIR ); -strlcat (cmv_name, file,FIRMWARE_NAME_MAX ); +strlcat (cmv_name, file,UEA_FW_NAME_MAX );if (ver ==2 ) -strlcat (cmv_name,".v2" ,FIRMWARE_NAME_MAX ); +strlcat (cmv_name,".v2" ,UEA_FW_NAME_MAX ); } static int request_cmvs_old(struct uea_softc *sc,
@@ -1574,7 +1575,7 @@ static int request_cmvs_old(struct uea_softc *sc, {int ret, size;u8 *data; -char cmv_name[FIRMWARE_NAME_MAX ];/* 30 bytes stack variable */ +char cmv_name[UEA_FW_NAME_MAX ];/* 30 bytes stack variable */ cmvs_file_name (sc, cmv_name,1 ); ret =request_firmware (fw, cmv_name, &sc->usb_dev->dev);
@@ -1608,7 +1609,7 @@ static int request_cmvs(struct uea_softc *sc,int ret, size;u32 crc;u8 *data; -char cmv_name[FIRMWARE_NAME_MAX ];/* 30 bytes stack variable */ +char cmv_name[UEA_FW_NAME_MAX ];/* 30 bytes stack variable */ cmvs_file_name (sc, cmv_name,2 ); ret =request_firmware (fw, cmv_name, &sc->usb_dev->dev);
Signature · 1 line
1.6.3.2
PATCH 18/64 firmware: tuners/xc2028: prepare for FIRMWARE_NAME_MAX removal
In reply to Greg KHFrom: Samuel Ortiz <[email protected]>
We're going to remove the FIRMWARE_NAME_MAX definition in order to avoid any firmware name length restriction.
This patch gets rid of the xc2028 FIRMWARE_NAME_MAX reference.
--- drivers/media/common/tuners/tuner-xc2028.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/common/tuners/tuner-xc2028.c +1 -1
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(audio_std,"NICAM/A\n" "NICAM/B\n"); -static char firmware_name[FIRMWARE_NAME_MAX ]; +static char firmware_name[30 ];module_param_string (firmware_name, firmware_name,sizeof (firmware_name),0 );MODULE_PARM_DESC (firmware_name,"Firmware file name. Allows overriding the " "default firmware name\n" );
Signature · 1 line
1.6.3.2
PATCH 19/64 firmware: dvb/dvb-usb: prepare for FIRMWARE_NAME_MAX removal
In reply to Greg KHFrom: Samuel Ortiz <[email protected]>
We're going to remove the FIRMWARE_NAME_MAX definition in order to avoid any firmware name length restriction.
This patch changes the dvb_usb_device_properties firmware field accordingly.
--- drivers/media/dvb/dvb-usb/dvb-usb.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/dvb/dvb-usb/dvb-usb.h +1 -1
@@ -196,7 +196,7 @@ struct dvb_usb_device_properties {#define CYPRESS_FX2 3int usb_ctrl;int (*download_firmware) (struct usb_device *,const struct firmware *); -const char firmware[FIRMWARE_NAME_MAX ]; +const char *firmware;int no_reconnect;int size_of_priv;
Signature · 1 line
1.6.3.2
PATCH 20/64 firmware: pcmcia/ds: prepare for FIRMWARE_NAME_MAX removal
In reply to Greg KHFrom: Samuel Ortiz <[email protected]>
We're going to remove the FIRMWARE_NAME_MAX definition in order to avoid any firmware name length restriction.
With the FIRMWARE_NAME_MAX removal, the ds.c reference becomes useless as we dont need to check for the firmware name length anymore.
--- drivers/pcmcia/ds.c | 12 +----------- 1 files changed, 1 insertions(+), 11 deletions(-)
drivers/pcmcia/ds.c +1 -11
@@ -828,7 +828,6 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) {struct pcmcia_socket *s = dev->socket;const struct firmware *fw; -char path[FIRMWARE_NAME_MAX ];int ret = -ENOMEM ;int no_funcs;int old_funcs;
@@ -839,16 +838,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)ds_dev_dbg (1 , &dev->dev,"trying to load CIS file %s\n" , filename); -if (strlen (filename) > (FIRMWARE_NAME_MAX -1 )) { -dev_printk (KERN_WARNING , &dev->dev, -"pcmcia: CIS filename is too long [%s]\n" , - filename); -return -EINVAL ; - } - -snprintf (path,sizeof (path),"%s" , filename); - -if (request_firmware (&fw, path, &dev->dev) ==0 ) { +if (request_firmware (&fw, filename, &dev->dev) ==0 ) {if (fw->size >=CISTPL_MAX_CIS_SIZE ) { ret = -EINVAL ; dev_printk(KERN_ERR, &dev->dev,
Signature · 1 line
1.6.3.2
PATCH 21/64 firmware: wireless/libertas: prepare for FIRMWARE_NAME_MAX removal
In reply to Greg KHFrom: John W. Linville <[email protected]>
We're going to remove the FIRMWARE_NAME_MAX definition in order to avoid any firmware name length restriction.
This patch eplaces the shared FIRMWARE_NAME_MAX definition with a libertas local one.
--- drivers/net/wireless/libertas/if_spi.c | 8 ++++---- drivers/net/wireless/libertas/if_spi.h | 3 +++ drivers/net/wireless/libertas/if_usb.c | 8 ++------ 3 files changed, 9 insertions(+), 10 deletions(-)
drivers/net/wireless/libertas/if_spi.c +4 -4
@@ -43,8 +43,8 @@ struct if_spi_card {struct lbs_private *priv;struct libertas_spi_platform_data *pdata; -char helper_fw_name[FIRMWARE_NAME_MAX ]; -char main_fw_name[FIRMWARE_NAME_MAX ]; +char helper_fw_name[IF_SPI_FW_NAME_MAX ]; +char main_fw_name[IF_SPI_FW_NAME_MAX ];/* The card ID and card revision, as reported by the hardware. */ u16 card_id;
@@ -1019,9 +1019,9 @@ static int if_spi_calculate_fw_names(u16 card_id,lbs_pr_err ("Unsupported chip_id: 0x%02x\n" , card_id);return -EAFNOSUPPORT ; } -snprintf (helper_fw,FIRMWARE_NAME_MAX ,"libertas/gspi%d_hlp.bin" , +snprintf (helper_fw,IF_SPI_FW_NAME_MAX ,"libertas/gspi%d_hlp.bin" , chip_id_to_device_name[i].name); -snprintf (main_fw,FIRMWARE_NAME_MAX ,"libertas/gspi%d.bin" , +snprintf (main_fw,IF_SPI_FW_NAME_MAX ,"libertas/gspi%d.bin" , chip_id_to_device_name[i].name);return 0 ; }
drivers/net/wireless/libertas/if_spi.h +3 -0
@@ -22,6 +22,9 @@#define IF_SPI_CMD_BUF_SIZE 2400/***************** Firmware *****************/ + +#define IF_SPI_FW_NAME_MAX 30 +struct chip_ident {u16 chip_id;u16 name;
drivers/net/wireless/libertas/if_usb.c +2 -6
@@ -61,11 +61,9 @@ static ssize_t if_usb_firmware_set(struct device *dev, {struct lbs_private *priv =to_net_dev (dev)->ml_priv;struct if_usb_card *cardp = priv->card; -char fwname[FIRMWARE_NAME_MAX ];int ret; -sscanf (buf,"%29s" , fwname);/* FIRMWARE_NAME_MAX - 1 = 29 */ - ret =if_usb_prog_firmware (cardp, fwname,BOOT_CMD_UPDATE_FW ); + ret =if_usb_prog_firmware (cardp, buf,BOOT_CMD_UPDATE_FW );if (ret ==0 )return count;
@@ -88,11 +86,9 @@ static ssize_t if_usb_boot2_set(struct device *dev, {struct lbs_private *priv =to_net_dev (dev)->ml_priv;struct if_usb_card *cardp = priv->card; -char fwname[FIRMWARE_NAME_MAX ];int ret; -sscanf (buf,"%29s" , fwname);/* FIRMWARE_NAME_MAX - 1 = 29 */ - ret =if_usb_prog_firmware (cardp, fwname,BOOT_CMD_UPDATE_BOOT2 ); + ret =if_usb_prog_firmware (cardp, buf,BOOT_CMD_UPDATE_BOOT2 );if (ret ==0 )return count;
Signature · 1 line
1.6.3.2
PATCH 22/64 firmware: FIRMWARE_NAME_MAX removal
In reply to Greg KHFrom: Samuel Ortiz <[email protected]>
As we're allocating the firmware name dynamically, we no longer need this definition.
This patch must be applied only after the 5 previous patches from this pacth set have been applied.
--- include/linux/firmware.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/firmware.h +0 -1
@@ -5,7 +5,6 @@#include <linux/types.h> #include <linux/compiler.h> -#define FIRMWARE_NAME_MAX 30#define FW_ACTION_NOHOTPLUG 0#define FW_ACTION_HOTPLUG 1
Signature · 1 line
1.6.3.2
PATCH 23/64 firmware: remove broken example files
In reply to Greg KHThe firmware example files are beyond broken, and will not work, and should not be used as an example at all. So lets remove them and hope someone writes new files sometime in the future.
--- samples/firmware_class/firmware_sample_driver.c | 121 ------------ .../firmware_sample_firmware_class.c | 204 -------------------- 2 files changed, 0 insertions(+), 325 deletions(-) delete mode 100644 samples/firmware_class/firmware_sample_driver.c delete mode 100644 samples/firmware_class/firmware_sample_firmware_class.c
samples/firmware_class/firmware_sample_driver.c deleted +0 -121
@@ -1,121 +0,0 @@ -/* -* firmware_sample_driver.c - -* -* Copyright (c) 2003 Manuel Estrada Sainz -* -* Sample code on how to use request_firmware() from drivers. -* -*/ - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/device.h> -#include <linux/string.h> -#include <linux/firmware.h> - -static struct device ghost_device = { - .bus_id ="ghost0" , -}; - - -static void sample_firmware_load (char *firmware,int size) -{ -u8 buf[size+1 ]; -memcpy (buf, firmware, size); - buf[size] ='\0' ; -printk (KERN_INFO "firmware_sample_driver: firmware: %s\n" , buf); -} - -static void sample_probe_default (void ) -{ -/* uses the default method to get the firmware */ -const struct firmware *fw_entry; -int retval; - -printk (KERN_INFO "firmware_sample_driver: " -"a ghost device got inserted :)\n" ); - - retval =request_firmware (&fw_entry,"sample_driver_fw" , &ghost_device); -if (retval) { -printk (KERN_ERR -"firmware_sample_driver: Firmware not available\n" ); -return ; - } - -sample_firmware_load (fw_entry->data, fw_entry->size); - -release_firmware (fw_entry); - -/* finish setting up the device */ -} - -static void sample_probe_specific (void ) -{ -int retval; -/* Uses some specific hotplug support to get the firmware from -* userspace directly into the hardware, or via some sysfs file */ - -/* NOTE: This currently doesn't work */ - -printk (KERN_INFO "firmware_sample_driver: " -"a ghost device got inserted :)\n" ); - - retval =request_firmware (NULL ,"sample_driver_fw" , &ghost_device); -if (retval) { -printk (KERN_ERR -"firmware_sample_driver: Firmware load failed\n" ); -return ; - } - -/* request_firmware blocks until userspace finished, so at -* this point the firmware should be already in the device */ - -/* finish setting up the device */ -} - -static void sample_probe_async_cont (const struct firmware *fw,void *context) -{ -if (!fw) { -printk (KERN_ERR -"firmware_sample_driver: firmware load failed\n" ); -return ; - } - -printk (KERN_INFO "firmware_sample_driver: device pointer \"%s\"\n" , - (char *)context); -sample_firmware_load (fw->data, fw->size); -} - -static void sample_probe_async (void ) -{ -/* Let's say that I can't sleep */ -int error; - error =request_firmware_nowait (THIS_MODULE ,FW_ACTION_NOHOTPLUG , -"sample_driver_fw" , &ghost_device, -"my device pointer" , - sample_probe_async_cont); -if (error) -printk (KERN_ERR "firmware_sample_driver:" -" request_firmware_nowait failed\n" ); -} - -static int __init sample_init (void ) -{ -device_initialize (&ghost_device); -/* since there is no real hardware insertion I just call the -* sample probe functions here */ -sample_probe_specific (); -sample_probe_default (); -sample_probe_async (); -return 0 ; -} - -static void __exit sample_exit(void) -{ -} - -module_init (sample_init); -module_exit (sample_exit); - -MODULE_LICENSE ("GPL" );
samples/firmware_class/firmware_sample_firmware_class.c deleted +0 -204
204 lines not on this page · raw message
Signature · 1 line
1.6.3.2
PATCH 24/64 driver core: fix gcc 4.3.3 warnings about string literals
In reply to Greg KHThis removes the
warning: format not a string literal and no format arguments
warnings in the driver core that gcc 4.3.3 complains about.
--- drivers/base/core.c | 4 ++-- drivers/base/firmware_class.c | 2 +- drivers/base/platform.c | 2 +- drivers/base/sys.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/base/core.c +2 -2
@@ -875,7 +875,7 @@ int device_add(struct device *dev)* the name, and force the use of dev_name() */ if (dev->init_name) { -dev_set_name (dev, dev->init_name); +dev_set_name (dev,"%s" , dev->init_name); dev->init_name =NULL ; }
@@ -1272,7 +1272,7 @@ struct device *__root_device_register(const char *name, struct module *owner)if (!root)return ERR_PTR (err); - err =dev_set_name (&root->dev, name); + err =dev_set_name (&root->dev,"%s" , name);if (err) {kfree (root);return ERR_PTR (err);
drivers/base/firmware_class.c +1 -1
@@ -399,7 +399,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, fw_priv->timeout.data = (u_long ) fw_priv;init_timer (&fw_priv->timeout); -dev_set_name (f_dev,dev_name (device)); +dev_set_name (f_dev,"%s" ,dev_name (device)); f_dev->parent = device; f_dev->class = &firmware_class;dev_set_drvdata (f_dev, fw_priv);
drivers/base/platform.c +1 -1
@@ -245,7 +245,7 @@ int platform_device_add(struct platform_device *pdev)if (pdev->id !=-1 )dev_set_name (&pdev->dev,"%s.%d" , pdev->name, pdev->id);else -dev_set_name (&pdev->dev, pdev->name); +dev_set_name (&pdev->dev,"%s" , pdev->name);for (i =0 ; i < pdev->num_resources; i++) {struct resource *p, *r = &pdev->resource[i];
drivers/base/sys.c +1 -1
@@ -141,7 +141,7 @@ int sysdev_class_register(struct sysdev_class *cls) cls->kset.kobj.ktype = &ktype_sysdev_class; cls->kset.kobj.kset = system_kset; - retval =kobject_set_name (&cls->kset.kobj, cls->name); + retval =kobject_set_name (&cls->kset.kobj,"%s" , cls->name);if (retval)return retval;
Signature · 1 line
1.6.3.2
PATCH 25/64 Driver Core: add nodename callbacks
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds the nodename callback for struct class, struct device_type and struct device, to allow drivers to send userspace hints on the device name and subdirectory that should be used for it.
--- drivers/base/core.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++- include/linux/device.h | 3 ++ 2 files changed, 53 insertions(+), 1 deletions(-)
drivers/base/core.c +50 -1
@@ -162,10 +162,18 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,struct device *dev =to_dev (kobj);int retval =0 ; -/* add the major/minor if present */ +/* add device node properties if present */ if (MAJOR (dev->devt)) { +const char *tmp; +const char *name; +add_uevent_var (env,"MAJOR=%u" ,MAJOR (dev->devt));add_uevent_var (env,"MINOR=%u" ,MINOR (dev->devt)); + name =device_get_nodename (dev, &tmp); +if (name) { +add_uevent_var (env,"DEVNAME=%s" , name); +kfree (tmp); + } }if (dev->type && dev->type->name)
@@ -1129,6 +1137,47 @@ static struct device *next_device(struct klist_iter *i) }/** +* device_get_nodename - path of device node file +* @dev: device +* @tmp: possibly allocated string +* +* Return the relative path of a possible device node. +* Non-default names may need to allocate a memory to compose +* a name. This memory is returned in tmp and needs to be +* freed by the caller. +*/ +const char *device_get_nodename (struct device *dev,const char **tmp) +{ +char *s; + + *tmp =NULL ; + +/* the device type may provide a specific name */ +if (dev->type && dev->type->nodename) + *tmp = dev->type->nodename (dev); +if (*tmp) +return *tmp; + +/* the class may provide a specific name */ +if (dev->class && dev->class->nodename) + *tmp = dev->class->nodename (dev); +if (*tmp) +return *tmp; + +/* return name without allocation, tmp == NULL */ +if (strchr (dev_name (dev),'!' ) ==NULL ) +return dev_name (dev); + +/* replace '!' in the name with '/' */ + *tmp =kstrdup (dev_name (dev),GFP_KERNEL ); +if (!*tmp) +return NULL ; +while ((s =strchr (*tmp,'!' ))) + s[0 ] ='/' ; +return *tmp; +} + +/** * device_for_each_child - device child iterator. * @parent: parent struct device. * @data: data for the callback.
include/linux/device.h +3 -0
@@ -194,6 +194,7 @@ struct class {struct kobject *dev_kobj;int (*dev_uevent)(struct device *dev,struct kobj_uevent_env *env); +char *(*nodename)(struct device *dev);void (*class_release)(struct class *class);void (*dev_release)(struct device *dev);
@@ -289,6 +290,7 @@ struct device_type {const char *name;struct attribute_group **groups;int (*uevent)(struct device *dev,struct kobj_uevent_env *env); +char *(*nodename)(struct device *dev);void (*release)(struct device *dev);struct dev_pm_ops *pm;
@@ -488,6 +490,7 @@ extern struct device *device_find_child(struct device *dev, void *data,extern int device_rename (struct device *dev,char *new_name);extern int device_move (struct device *dev,struct device *new_parent,enum dpm_order dpm_order); +extern const char *device_get_nodename (struct device *dev,const char **tmp);/* * Root device objects for grouping under /sys/devices
Signature · 1 line
1.6.3.2
PATCH 26/64 Driver Core: misc: add nodename support for misc devices.
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support for misc devices to report their requested nodename to userspace. It also updates a number of misc drivers to provide the needed subdirectory and device name to be used for them.
--- arch/x86/kernel/microcode_core.c | 1 + drivers/char/hw_random/core.c | 1 + drivers/char/misc.c | 15 ++++++++++++--- drivers/md/dm-ioctl.c | 1 + drivers/net/tun.c | 1 + include/linux/miscdevice.h | 1 + 6 files changed, 17 insertions(+), 3 deletions(-)
arch/x86/kernel/microcode_core.c +1 -0
@@ -236,6 +236,7 @@ static const struct file_operations microcode_fops = {static struct miscdevice microcode_dev = { .minor =MICROCODE_MINOR , .name ="microcode" , + .devnode ="cpu/microcode" , .fops = µcode_fops, };
drivers/char/hw_random/core.c +1 -0
@@ -153,6 +153,7 @@ static const struct file_operations rng_chrdev_ops = {static struct miscdevice rng_miscdev = { .minor =RNG_MISCDEV_MINOR , .name =RNG_MODULE_NAME , + .devnode ="hwrng" , .fops = &rng_chrdev_ops, };
drivers/char/misc.c +12 -3
@@ -168,7 +168,6 @@ static const struct file_operations misc_fops = { .open = misc_open, }; -/** * misc_register - register a miscellaneous device * @misc: device structure
@@ -217,8 +216,8 @@ int misc_register(struct miscdevice * misc) misc_minors[misc->minor >>3 ] |=1 << (misc->minor &7 ); dev =MKDEV (MISC_MAJOR , misc->minor); - misc->this_device =device_create (misc_class, misc->parent, dev,NULL , -"%s" , misc->name); + misc->this_device =device_create (misc_class, misc->parent, dev, + misc,"%s" , misc->name);if (IS_ERR (misc->this_device)) { err =PTR_ERR (misc->this_device); goto out;
@@ -264,6 +263,15 @@ int misc_deregister(struct miscdevice *misc)EXPORT_SYMBOL (misc_register);EXPORT_SYMBOL (misc_deregister); +static char *misc_nodename (struct device *dev) +{ +struct miscdevice *c =dev_get_drvdata (dev); + +if (c->devnode) +return kstrdup (c->devnode,GFP_KERNEL ); +return NULL ; +} +static int __init misc_init (void ) {int err;
@@ -279,6 +287,7 @@ static int __init misc_init(void) err = -EIO ;if (register_chrdev (MISC_MAJOR ,"misc" ,&misc_fops)) goto fail_printk; + misc_class->nodename = misc_nodename;return 0 ; fail_printk:
drivers/md/dm-ioctl.c +1 -0
@@ -1513,6 +1513,7 @@ static const struct file_operations _ctl_fops = {static struct miscdevice _dm_misc = { .minor =MISC_DYNAMIC_MINOR , .name =DM_NAME , + .devnode ="mapper/control" , .fops = &_ctl_fops };
drivers/net/tun.c +1 -0
@@ -1366,6 +1366,7 @@ static const struct file_operations tun_fops = {static struct miscdevice tun_miscdev = { .minor =TUN_MINOR , .name ="tun" , + .devnode ="net/tun" , .fops = &tun_fops, };
include/linux/miscdevice.h +1 -0
@@ -41,6 +41,7 @@ struct miscdevice {struct list_head list;struct device *parent;struct device *this_device; +const char *devnode; };extern int misc_register (struct miscdevice * misc);
Signature · 1 line
1.6.3.2
PATCH 27/64 Driver Core: usb: add nodename support for usb drivers.
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support for USB drivers to report their requested nodename to userspace. It also updates a number of USB drivers to provide the needed subdirectory and device name to be used for them.
--- drivers/hid/usbhid/hiddev.c | 7 ++++++- drivers/media/video/dabusb.c | 6 ++++++ drivers/usb/class/usblp.c | 6 ++++++ drivers/usb/core/file.c | 13 ++++++++++++- drivers/usb/core/usb.c | 11 +++++++++++ drivers/usb/misc/iowarrior.c | 6 ++++++ drivers/usb/misc/legousbtower.c | 6 ++++++ include/linux/usb.h | 3 +++ 8 files changed, 56 insertions(+), 2 deletions(-)
drivers/hid/usbhid/hiddev.c +6 -1
@@ -850,8 +850,14 @@ static const struct file_operations hiddev_fops = {#endif }; +static char *hiddev_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); +} +static struct usb_class_driver hiddev_class = { .name ="hiddev%d" , + .nodename = hiddev_nodename, .fops = &hiddev_fops, .minor_base =HIDDEV_MINOR_BASE , };
@@ -955,7 +961,6 @@ static int hiddev_usbd_probe(struct usb_interface *intf,return -ENODEV ; } -static /* const */ struct usb_driver hiddev_driver = { .name ="hiddev" , .probe = hiddev_usbd_probe,
drivers/media/video/dabusb.c +6 -0
@@ -747,8 +747,14 @@ static const struct file_operations dabusb_fops = .release = dabusb_release, }; +static char *dabusb_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); +} +static struct usb_class_driver dabusb_class = { .name ="dabusb%d" , + .nodename = dabusb_nodename, .fops = &dabusb_fops, .minor_base =DABUSB_MINOR , };
drivers/usb/class/usblp.c +6 -0
@@ -1057,8 +1057,14 @@ static const struct file_operations usblp_fops = { .release = usblp_release, }; +static char *usblp_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); +} +static struct usb_class_driver usblp_class = { .name ="lp%d" , + .nodename = usblp_nodename, .fops = &usblp_fops, .minor_base =USBLP_MINOR_BASE , };
drivers/usb/core/file.c +12 -1
@@ -67,6 +67,16 @@ static struct usb_class {struct class *class; } *usb_class; +static char *usb_nodename (struct device *dev) +{ +struct usb_class_driver *drv; + + drv =dev_get_drvdata (dev); +if (!drv || !drv->nodename) +return NULL ; +return drv->nodename (dev); +} +static int init_usb_class (void ) {int result =0 ;
@@ -90,6 +100,7 @@ static int init_usb_class(void)kfree (usb_class); usb_class =NULL ; } + usb_class->class->nodename = usb_nodename; exit:return result;
@@ -198,7 +209,7 @@ int usb_register_dev(struct usb_interface *intf,else temp = name; intf->usb_dev =device_create (usb_class->class, &intf->dev, -MKDEV (USB_MAJOR , minor),NULL , +MKDEV (USB_MAJOR , minor), class_driver,"%s" , temp);if (IS_ERR (intf->usb_dev)) {down_write (&minor_rwsem);
drivers/usb/core/usb.c +11 -0
@@ -305,10 +305,21 @@ static struct dev_pm_ops usb_device_pm_ops = {#endif /* CONFIG_PM */ + +static char *usb_nodename (struct device *dev) +{ +struct usb_device *usb_dev; + + usb_dev =to_usb_device (dev); +return kasprintf (GFP_KERNEL ,"bus/usb/%03d/%03d" , + usb_dev->bus->busnum, usb_dev->devnum); +} +struct device_type usb_device_type = { .name ="usb_device" , .release = usb_release_dev, .uevent = usb_dev_uevent, + .nodename = usb_nodename, .pm = &usb_device_pm_ops, };
drivers/usb/misc/iowarrior.c +6 -0
@@ -726,12 +726,18 @@ static const struct file_operations iowarrior_fops = { .poll = iowarrior_poll, }; +static char *iowarrior_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); +} +/* * usb class driver info in order to get a minor number from the usb core, * and to have the device registered with devfs and the driver core */ static struct usb_class_driver iowarrior_class = { .name ="iowarrior%d" , + .nodename = iowarrior_nodename, .fops = &iowarrior_fops, .minor_base =IOWARRIOR_MINOR_BASE , };
drivers/usb/misc/legousbtower.c +6 -0
@@ -266,12 +266,18 @@ static const struct file_operations tower_fops = { .llseek = tower_llseek, }; +static char *legousbtower_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); +} +/* * usb class driver info in order to get a minor number from the usb core, * and to have the device registered with the driver core */ static struct usb_class_driver tower_class = { .name ="legousbtower%d" , + .nodename = legousbtower_nodename, .fops = &tower_fops, .minor_base =LEGO_USB_TOWER_MINOR_BASE , };
include/linux/usb.h +3 -0
@@ -869,6 +869,8 @@ struct usb_driver {* struct usb_device_driver - identifies USB device driver to usbcore * @name: The driver name should be unique among USB drivers, * and should normally be the same as the module name. +* @nodename: Callback to provide a naming hint for a possible +* device node to create. * @probe: Called to see if the driver is willing to manage a particular * device. If it is, probe returns zero and uses dev_set_drvdata() * to associate driver-specific data with the device. If unwilling
@@ -912,6 +914,7 @@ extern struct bus_type usb_bus_type;*/ struct usb_class_driver {char *name; +char *(*nodename)(struct device *dev);const struct file_operations *fops;int minor_base; };
Signature · 1 line
1.6.3.2
PATCH 28/64 Driver Core: block: add nodename support for block drivers.
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support for block drivers to report their requested nodename to userspace. It also updates a number of block drivers to provide the needed subdirectory and device name to be used for them.
--- block/genhd.c | 10 ++++++++++ drivers/block/pktcdvd.c | 7 +++++++ include/linux/genhd.h | 2 +- 3 files changed, 18 insertions(+), 1 deletions(-)
block/genhd.c +10 -0
@@ -996,10 +996,20 @@ struct class block_class = { .name = "block", }; +static char *block_nodename (struct device *dev) +{ +struct gendisk *disk =dev_to_disk (dev); + +if (disk->nodename) +return disk->nodename (disk); +return NULL ; +} +static struct device_type disk_type = { .name ="disk" , .groups = disk_attr_groups, .release = disk_release, + .nodename = block_nodename, };#ifdef CONFIG_PROC_FS
drivers/block/pktcdvd.c +7 -0
@@ -2855,6 +2855,11 @@ static struct block_device_operations pktcdvd_ops = { .media_changed = pkt_media_changed, }; +static char *pktcdvd_nodename (struct gendisk *gd) +{ +return kasprintf (GFP_KERNEL ,"pktcdvd/%s" , gd->disk_name); +} +/* * Set up mapping from pktcdvd device to CD-ROM device. */
@@ -2907,6 +2912,7 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev) disk->fops = &pktcdvd_ops; disk->flags =GENHD_FL_REMOVABLE ;strcpy (disk->disk_name, pd->name); + disk->nodename = pktcdvd_nodename; disk->private_data = pd; disk->queue =blk_alloc_queue (GFP_KERNEL );if (!disk->queue)
@@ -3062,6 +3068,7 @@ static const struct file_operations pkt_ctl_fops = {static struct miscdevice pkt_misc = { .minor =MISC_DYNAMIC_MINOR , .name =DRIVER_NAME , + .name ="pktcdvd/control" , .fops = &pkt_ctl_fops };
include/linux/genhd.h +1 -1
@@ -142,7 +142,7 @@ struct gendisk {* disks that can't be partitioned. */ char disk_name[DISK_NAME_LEN ];/* name of major driver */ - +char *(*nodename)(struct gendisk *gd);/* Array of pointers to partitions indexed by partno. * Protected with matching bdev lock but stat and other * non-critical accesses use RCU. Always access through
Signature · 1 line
1.6.3.2
PATCH 29/64 Driver Core: x86: add nodename for cpuid and msr drivers.
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support to the x86 cpuid and msr drivers to report the proper device name to userspace for their devices.
--- arch/x86/kernel/cpuid.c | 6 ++++++ arch/x86/kernel/msr.c | 6 ++++++ 2 files changed, 12 insertions(+), 0 deletions(-)
arch/x86/kernel/cpuid.c +6 -0
@@ -182,6 +182,11 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier = .notifier_call = cpuid_class_cpu_callback, }; +static char *cpuid_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"cpu/%u/cpuid" ,MINOR (dev->devt)); +} +static int __init cpuid_init (void ) {int i, err =0 ;
@@ -198,6 +203,7 @@ static int __init cpuid_init(void) err =PTR_ERR (cpuid_class); goto out_chrdev; } + cpuid_class->nodename = cpuid_nodename;for_each_online_cpu (i) { err =cpuid_device_create (i);if (err !=0 )
arch/x86/kernel/msr.c +6 -0
@@ -196,6 +196,11 @@ static struct notifier_block __refdata msr_class_cpu_notifier = { .notifier_call = msr_class_cpu_callback, }; +static char *msr_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"cpu/%u/msr" ,MINOR (dev->devt)); +} +static int __init msr_init (void ) {int i, err =0 ;
@@ -212,6 +217,7 @@ static int __init msr_init(void) err =PTR_ERR (msr_class); goto out_chrdev; } + msr_class->nodename = msr_nodename;for_each_online_cpu (i) { err =msr_device_create (i);if (err !=0 )
Signature · 1 line
1.6.3.2
PATCH 30/64 Driver Core: dvb: add nodename for dvb drivers
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support to the dvb core to report the proper device name to userspace for their devices.
--- drivers/media/dvb/dvb-core/dvbdev.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/media/dvb/dvb-core/dvbdev.c +10 -0
@@ -447,6 +447,15 @@ static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)return 0 ; } +static char *dvb_nodename (struct device *dev) +{ +struct dvb_device *dvbdev =dev_get_drvdata (dev); + +return kasprintf (GFP_KERNEL ,"dvb/adapter%d/%s%d" , + dvbdev->adapter->num, dnames[dvbdev->type], dvbdev->id); +} + +static int __init init_dvbdev (void ) {int retval;
@@ -469,6 +478,7 @@ static int __init init_dvbdev(void) goto error; } dvb_class->dev_uevent = dvb_uevent; + dvb_class->nodename = dvb_nodename;return 0 ; error:
Signature · 1 line
1.6.3.2
PATCH 31/64 Driver Core: input: add nodename for input drivers
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support to the input core to report the proper device name to userspace for their devices.
--- drivers/input/input.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/input/input.c +6 -0
@@ -1265,8 +1265,14 @@ static struct device_type input_dev_type = { .uevent = input_dev_uevent, }; +static char *input_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"input/%s" ,dev_name (dev)); +} +struct class input_class = { .name ="input" , + .nodename = input_nodename, };EXPORT_SYMBOL_GPL (input_class);
Signature · 1 line
1.6.3.2
PATCH 32/64 Driver Core: sound: add nodename for sound drivers
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support to the sound core to report the proper device name to userspace for their devices.
--- sound/sound_core.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
sound/sound_core.c +7 -0
@@ -27,6 +27,11 @@ MODULE_DESCRIPTION("Core sound module");MODULE_AUTHOR ("Alan Cox" );MODULE_LICENSE ("GPL" ); +static char *sound_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"snd/%s" ,dev_name (dev)); +} +static int __init init_soundcore (void ) {int rc;
@@ -41,6 +46,8 @@ static int __init init_soundcore(void)return PTR_ERR (sound_class); } + sound_class->nodename = sound_nodename; +return 0 ; }
Signature · 1 line
1.6.3.2
PATCH 33/64 Driver Core: raw: add nodename for raw devices
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support to the raw driver to report the proper device name to userspace for the raw devices.
--- drivers/char/raw.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/char/raw.c +6 -0
@@ -261,6 +261,11 @@ static const struct file_operations raw_ctl_fops = {static struct cdev raw_cdev; +static char *raw_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"raw/%s" ,dev_name (dev)); +} +static int __init raw_init (void ) {dev_t dev =MKDEV (RAW_MAJOR ,0 );
@@ -284,6 +289,7 @@ static int __init raw_init(void) ret =PTR_ERR (raw_class); goto error_region; } + raw_class->nodename = raw_nodename;device_create (raw_class,NULL ,MKDEV (RAW_MAJOR ,0 ),NULL ,"rawctl" );return 0 ;
Signature · 1 line
1.6.3.2
PATCH 34/64 Driver Core: drm: add nodename for drm devices
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support to the drm core to report the proper device name to userspace for the drm devices.
--- drivers/gpu/drm/drm_sysfs.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_sysfs.c +7 -0
@@ -70,6 +70,11 @@ static ssize_t version_show(struct class *dev, char *buf) CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); } +static char *drm_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"dri/%s" ,dev_name (dev)); +} + static CLASS_ATTR(version, S_IRUGO, version_show, NULL);/**
@@ -101,6 +106,8 @@ struct class *drm_sysfs_create(struct module *owner, char *name)if (err) goto err_out_class; + class->nodename = drm_nodename; +return class; err_out_class:
Signature · 1 line
1.6.3.2
PATCH 35/64 Driver Core: aoe: add nodename for aoe devices
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support to the AOE core to report the proper device name to userspace for the AOE devices.
--- drivers/block/aoe/aoechr.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/block/aoe/aoechr.c +7 -0
@@ -266,6 +266,11 @@ static const struct file_operations aoe_fops = { .owner = THIS_MODULE, }; +static char *aoe_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"etherd/%s" ,dev_name (dev)); +} +int __init aoechr_init (void ) {
@@ -283,6 +288,8 @@ aoechr_init(void)unregister_chrdev (AOE_MAJOR ,"aoechr" );return PTR_ERR (aoe_class); } + aoe_class->nodename = aoe_nodename; +for (i =0 ; i <ARRAY_SIZE (chardevs); ++i) device_create(aoe_class, NULL, MKDEV(AOE_MAJOR, chardevs[i].minor), NULL,
Signature · 1 line
1.6.3.2
PATCH 36/64 Driver Core: bsg: add nodename for bsg driver
In reply to Greg KHFrom: Kay Sievers <[email protected]>
This adds support to the BSG driver to report the proper device name to userspace for the bsg devices.
--- block/bsg.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
block/bsg.c +6 -0
@@ -1065,6 +1065,11 @@ EXPORT_SYMBOL_GPL(bsg_register_queue);static struct cdev bsg_cdev; +static char *bsg_nodename (struct device *dev) +{ +return kasprintf (GFP_KERNEL ,"bsg/%s" ,dev_name (dev)); +} +static int __init bsg_init (void ) {int ret, i;
@@ -1085,6 +1090,7 @@ static int __init bsg_init(void) ret =PTR_ERR (bsg_class); goto destroy_kmemcache; } + bsg_class->nodename = bsg_nodename; ret =alloc_chrdev_region (&devid,0 ,BSG_MAX_DEVS ,"bsg" );if (ret)
Signature · 1 line
1.6.3.2
PATCH 37/64 eisa: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/eisa/pci_eisa.c | 2 +- drivers/eisa/virtual_root.c | 2 +- include/linux/eisa.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/eisa/pci_eisa.c +1 -1
@@ -31,11 +31,11 @@ static int __init pci_eisa_init(struct pci_dev *pdev, } pci_eisa_root.dev = &pdev->dev; - pci_eisa_root.dev->driver_data = &pci_eisa_root; pci_eisa_root.res = pdev->bus->resource[0 ]; pci_eisa_root.bus_base_addr = pdev->bus->resource[0 ]->start; pci_eisa_root.slots =EISA_MAX_SLOTS ; pci_eisa_root.dma_mask = pdev->dma_mask; +dev_set_drvdata (pci_eisa_root.dev, &pci_eisa_root);if (eisa_root_register (&pci_eisa_root)) {printk (KERN_ERR "pci_eisa : Could not register EISA root\n" );
drivers/eisa/virtual_root.c +1 -1
@@ -57,7 +57,7 @@ static int __init virtual_eisa_root_init (void) eisa_bus_root.force_probe = force_probe; - eisa_root_dev.dev.driver_data = &eisa_bus_root; +dev_set_drvdata (&eisa_root_dev.dev, &eisa_bus_root);if (eisa_root_register (&eisa_bus_root)) {/* A real bridge may have been registered before
include/linux/eisa.h +2 -2
@@ -78,12 +78,12 @@ static inline void eisa_driver_unregister (struct eisa_driver *edrv) { }/* Mimics pci.h... */ static inline void *eisa_get_drvdata (struct eisa_device *edev) { -return edev->dev.driver_data; +return dev_get_drvdata (&edev->dev); }static inline void eisa_set_drvdata (struct eisa_device *edev,void *data) { - edev->dev.driver_data = data; +dev_set_drvdata (&edev->dev, data); }/* The EISA root device. There's rumours about machines with multiple
Signature · 1 line
1.6.3.2
PATCH 38/64 firewire: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/firewire/fw-sbp2.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/firewire/fw-sbp2.c +3 -3
@@ -1125,7 +1125,7 @@ static int sbp2_probe(struct device *dev)return -ENOMEM ; tgt = (struct sbp2_target *)shost->hostdata; - unit->device.driver_data = tgt; +dev_set_drvdata (&unit->device, tgt); tgt->unit = unit;kref_init (&tgt->kref);INIT_LIST_HEAD (&tgt->lu_list);
@@ -1180,7 +1180,7 @@ static int sbp2_probe(struct device *dev)static int sbp2_remove (struct device *dev) {struct fw_unit *unit =fw_unit (dev); -struct sbp2_target *tgt = unit->device.driver_data; +struct sbp2_target *tgt =dev_get_drvdata (&unit->device);sbp2_target_put (tgt);return 0 ;
@@ -1240,7 +1240,7 @@ static void sbp2_reconnect(struct work_struct *work)static void sbp2_update (struct fw_unit *unit) { -struct sbp2_target *tgt = unit->device.driver_data; +struct sbp2_target *tgt =dev_get_drvdata (&unit->device);struct sbp2_logical_unit *lu;fw_device_enable_phys_dma (fw_device (unit->device.parent));
Signature · 1 line
1.6.3.2
PATCH 39/64 ide: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/ide/ide-pm.c | 6 ++++-- drivers/ide/ide-probe.c | 4 ++-- drivers/ide/ide_platform.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/ide/ide-pm.c +4 -2
@@ -3,7 +3,8 @@int generic_ide_suspend (struct device *dev,pm_message_t mesg) { -ide_drive_t *drive = dev->driver_data, *pair =ide_get_pair_dev (drive); +ide_drive_t *drive =dev_get_drvdata (dev); +ide_drive_t *pair =ide_get_pair_dev (drive);ide_hwif_t *hwif = drive->hwif;struct request *rq;struct request_pm_state rqpm;
@@ -34,7 +35,8 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)int generic_ide_resume (struct device *dev) { -ide_drive_t *drive = dev->driver_data, *pair =ide_get_pair_dev (drive); +ide_drive_t *drive =dev_get_drvdata (dev); +ide_drive_t *pair =ide_get_pair_dev (drive);ide_hwif_t *hwif = drive->hwif;struct request *rq;struct request_pm_state rqpm;
drivers/ide/ide-probe.c +2 -2
@@ -535,7 +535,7 @@ static int ide_register_port(ide_hwif_t *hwif)/* register with global device tree */ dev_set_name (&hwif->gendev, hwif->name); - hwif->gendev.driver_data = hwif; +dev_set_drvdata (&hwif->gendev, hwif);if (hwif->gendev.parent ==NULL ) hwif->gendev.parent = hwif->dev; hwif->gendev.release = hwif_release_dev;
@@ -987,9 +987,9 @@ static void hwif_register_devices(ide_hwif_t *hwif)int ret;dev_set_name (dev,"%u.%u" , hwif->index, i); +dev_set_drvdata (dev, drive); dev->parent = &hwif->gendev; dev->bus = &ide_bus_type; - dev->driver_data = drive; dev->release = drive_release_dev; ret =device_register (dev);
drivers/ide/ide_platform.c +1 -1
@@ -112,7 +112,7 @@ out: static int __devexit plat_ide_remove(struct platform_device *pdev) { -struct ide_host *host = pdev->dev.driver_data; +struct ide_host *host =dev_get_drvdata (&pdev->dev);ide_host_remove (host);
Signature · 1 line
1.6.3.2
PATCH 40/64 ieee1394: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/ieee1394/eth1394.c | 16 +++++++--------- drivers/ieee1394/sbp2.c | 8 ++++---- 2 files changed, 11 insertions(+), 13 deletions(-)
drivers/ieee1394/eth1394.c +7 -9
@@ -361,7 +361,7 @@ static int eth1394_new_node(struct eth1394_host_info *hi, node_info->pdg.sz =0 ; node_info->fifo =CSR1212_INVALID_ADDR_SPACE ; - ud->device.driver_data = node_info; +dev_set_drvdata (&ud->device, node_info); new_node->ud = ud; priv =netdev_priv (hi->dev);
@@ -406,7 +406,7 @@ static int eth1394_remove(struct device *dev)list_del (&old_node->list);kfree (old_node); - node_info = (struct eth1394_node_info *)ud->device.driver_data; + node_info =dev_get_drvdata (&ud->device);spin_lock_irqsave (&node_info->pdg.lock, flags);/* The partial datagram list should be empty, but we'll just
@@ -416,7 +416,7 @@ static int eth1394_remove(struct device *dev)spin_unlock_irqrestore (&node_info->pdg.lock, flags);kfree (node_info); - ud->device.driver_data =NULL ; +dev_set_drvdata (&ud->device,NULL );return 0 ; }
@@ -688,7 +688,7 @@ static void ether1394_host_reset(struct hpsb_host *host)ether1394_reset_priv (dev,0 );list_for_each_entry (node, &priv->ip_node_list, list) { - node_info = node->ud->device.driver_data; + node_info =dev_get_drvdata (&node->ud->device);spin_lock_irqsave (&node_info->pdg.lock, flags);
@@ -872,8 +872,7 @@ static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev,if (!node)return cpu_to_be16 (0 ); - node_info = - (struct eth1394_node_info *)node->ud->device.driver_data; + node_info =dev_get_drvdata (&node->ud->device);/* Update our speed/payload/fifo_offset table */ node_info->maxpayload = maxpayload;
@@ -1080,7 +1079,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, priv->ud_list[NODEID_TO_NODE (srcid)] = ud; } - node_info = (struct eth1394_node_info *)ud->device.driver_data; + node_info =dev_get_drvdata (&ud->device);/* First, did we receive a fragmented or unfragmented datagram? */ hdr->words.word1 =ntohs (hdr->words.word1);
@@ -1617,8 +1616,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev)if (!node) goto fail; - node_info = - (struct eth1394_node_info *)node->ud->device.driver_data; + node_info =dev_get_drvdata (&node->ud->device);if (node_info->fifo ==CSR1212_INVALID_ADDR_SPACE ) goto fail;
drivers/ieee1394/sbp2.c +4 -4
@@ -718,7 +718,7 @@ static int sbp2_remove(struct device *dev)struct scsi_device *sdev; ud = container_of(dev, struct unit_directory, device); - lu = ud->device.driver_data; + lu =dev_get_drvdata (&ud->device);if (!lu)return 0 ;
@@ -746,7 +746,7 @@ static int sbp2_remove(struct device *dev)static int sbp2_update (struct unit_directory *ud) { -struct sbp2_lu *lu = ud->device.driver_data; +struct sbp2_lu *lu =dev_get_drvdata (&ud->device);if (sbp2_reconnect_device (lu) !=0 ) {/*
@@ -815,7 +815,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud)atomic_set (&lu->state,SBP2LU_STATE_RUNNING );INIT_WORK (&lu->protocol_work,NULL ); - ud->device.driver_data = lu; +dev_set_drvdata (&ud->device, lu); hi =hpsb_get_hostinfo (&sbp2_highlevel, ud->ne->host);if (!hi) {
@@ -1051,7 +1051,7 @@ static void sbp2_remove_device(struct sbp2_lu *lu)hpsb_unregister_addrspace (&sbp2_highlevel, hi->host, lu->status_fifo_addr); - lu->ud->device.driver_data =NULL ; +dev_set_drvdata (&lu->ud->device,NULL );module_put (hi->host->driver->owner); no_hi:
Signature · 1 line
1.6.3.2
PATCH 41/64 infiniband: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/infiniband/core/sysfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/infiniband/core/sysfs.c +1 -1
@@ -760,9 +760,9 @@ int ib_device_register_sysfs(struct ib_device *device)int i; class_dev->class = &ib_class; - class_dev->driver_data = device; class_dev->parent = device->dma_device;dev_set_name (class_dev, device->name); +dev_set_drvdata (class_dev, device);INIT_LIST_HEAD (&device->port_list);
Signature · 1 line
1.6.3.2
PATCH 42/64 input: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/input/touchscreen/wm97xx-core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/input/touchscreen/wm97xx-core.c +1 -1
@@ -569,7 +569,7 @@ static int wm97xx_probe(struct device *dev)mutex_init (&wm->codec_mutex); wm->dev = dev; - dev->driver_data = wm; +dev_set_drvdata (dev, wm); wm->ac97 =to_ac97_t (dev);/* check that we have a supported codec */
Signature · 1 line
1.6.3.2
PATCH 43/64 media: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/media/dvb/firewire/firedtv-1394.c | 4 ++-- drivers/media/dvb/firewire/firedtv-dvb.c | 2 +- drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-)
drivers/media/dvb/firewire/firedtv-1394.c +2 -2
@@ -225,7 +225,7 @@ fail_free:static int node_remove (struct device *dev) { -struct firedtv *fdtv = dev->driver_data; +struct firedtv *fdtv =dev_get_drvdata (dev);fdtv_dvb_unregister (fdtv);
@@ -242,7 +242,7 @@ static int node_remove(struct device *dev)static int node_update (struct unit_directory *ud) { -struct firedtv *fdtv = ud->device.driver_data; +struct firedtv *fdtv =dev_get_drvdata (&ud->device);if (fdtv->isochannel >=0 ) cmp_establish_pp_connection(fdtv, fdtv->subunit,
drivers/media/dvb/firewire/firedtv-dvb.c +1 -1
@@ -268,7 +268,7 @@ struct firedtv *fdtv_alloc(struct device *dev,if (!fdtv)return NULL ; - dev->driver_data = fdtv; +dev_set_drvdata (dev, fdtv); fdtv->device = dev; fdtv->isochannel =-1 ; fdtv->voltage =0xff ;
drivers/media/video/pvrusb2/pvrusb2-sysfs.c +11 -11
@@ -539,7 +539,7 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp) &sfp->attr_unit_number); }pvr2_sysfs_trace ("Destroying class_dev id=%p" ,sfp->class_dev); - sfp->class_dev->driver_data =NULL ; +dev_set_drvdata (sfp->class_dev,NULL );device_unregister (sfp->class_dev); sfp->class_dev =NULL ; }
@@ -549,7 +549,7 @@ static ssize_t v4l_minor_number_show(struct device *class_dev, struct device_attribute *attr, char *buf) { struct pvr2_sysfs *sfp; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ; return scnprintf(buf,PAGE_SIZE,"%d\n", pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,
@@ -561,7 +561,7 @@ static ssize_t bus_info_show(struct device *class_dev, struct device_attribute *attr, char *buf) { struct pvr2_sysfs *sfp; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ;return scnprintf (buf,PAGE_SIZE ,"%s\n" ,pvr2_hdw_get_bus_info (sfp->channel.hdw));
@@ -572,7 +572,7 @@ static ssize_t hdw_name_show(struct device *class_dev, struct device_attribute *attr, char *buf) { struct pvr2_sysfs *sfp; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ;return scnprintf (buf,PAGE_SIZE ,"%s\n" ,pvr2_hdw_get_type (sfp->channel.hdw));
@@ -583,7 +583,7 @@ static ssize_t hdw_desc_show(struct device *class_dev, struct device_attribute *attr, char *buf) { struct pvr2_sysfs *sfp; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ;return scnprintf (buf,PAGE_SIZE ,"%s\n" ,pvr2_hdw_get_desc (sfp->channel.hdw));
@@ -595,7 +595,7 @@ static ssize_t v4l_radio_minor_number_show(struct device *class_dev, char *buf) {struct pvr2_sysfs *sfp; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ; return scnprintf(buf,PAGE_SIZE,"%d\n", pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,
@@ -607,7 +607,7 @@ static ssize_t unit_number_show(struct device *class_dev, struct device_attribute *attr, char *buf) { struct pvr2_sysfs *sfp; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ;return scnprintf (buf,PAGE_SIZE ,"%d\n" ,pvr2_hdw_get_unit_number (sfp->channel.hdw));
@@ -635,7 +635,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp, class_dev->parent = &usb_dev->dev; sfp->class_dev = class_dev; - class_dev->driver_data = sfp; +dev_set_drvdata (class_dev, sfp); ret =device_register (class_dev);if (ret) { pvr2_trace(PVR2_TRACE_ERROR_LEGS,
@@ -792,7 +792,7 @@ static ssize_t debuginfo_show(struct device *class_dev, struct device_attribute *attr, char *buf) { struct pvr2_sysfs *sfp; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ;pvr2_hdw_trigger_module_log (sfp->channel.hdw);return pvr2_debugifc_print_info (sfp->channel.hdw,buf,PAGE_SIZE );
@@ -803,7 +803,7 @@ static ssize_t debugcmd_show(struct device *class_dev, struct device_attribute *attr, char *buf) { struct pvr2_sysfs *sfp; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ;return pvr2_debugifc_print_status (sfp->channel.hdw,buf,PAGE_SIZE ); }
@@ -816,7 +816,7 @@ static ssize_t debugcmd_store(struct device *class_dev,struct pvr2_sysfs *sfp;int ret; - sfp = (struct pvr2_sysfs *)class_dev->driver_data; + sfp =dev_get_drvdata (class_dev);if (!sfp)return -EINVAL ; ret =pvr2_debugifc_docmd (sfp->channel.hdw,buf,count);
Signature · 1 line
1.6.3.2
PATCH 44/64 mfd: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/mfd/htc-pasic3.c | 4 ++-- drivers/mfd/pcf50633-core.c | 2 +- drivers/mfd/wm8400-core.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/htc-pasic3.c +2 -2
@@ -35,7 +35,7 @@ struct pasic3_data {*/ void pasic3_write_register (struct device *dev,u32 reg,u8 val) { -struct pasic3_data *asic = dev->driver_data; +struct pasic3_data *asic =dev_get_drvdata (dev);int bus_shift = asic->bus_shift;void __iomem *addr = asic->mapping + (REG_ADDR << bus_shift);void __iomem *data = asic->mapping + (REG_DATA << bus_shift);
@@ -50,7 +50,7 @@ EXPORT_SYMBOL(pasic3_write_register); /* for leds-pasic3 */*/ u8 pasic3_read_register (struct device *dev,u32 reg) { -struct pasic3_data *asic = dev->driver_data; +struct pasic3_data *asic =dev_get_drvdata (dev);int bus_shift = asic->bus_shift;void __iomem *addr = asic->mapping + (REG_ADDR << bus_shift);void __iomem *data = asic->mapping + (REG_DATA << bus_shift);
drivers/mfd/pcf50633-core.c +1 -1
@@ -618,7 +618,7 @@ static int __devinit pcf50633_probe(struct i2c_client *client, pdev->dev.parent = pcf->dev; pdev->dev.platform_data = &pdata->reg_init_data[i]; - pdev->dev.driver_data = pcf; +dev_set_drvdata (&pdev->dev, pcf); pcf->regulator_pdev[i] = pdev;platform_device_add (pdev);
drivers/mfd/wm8400-core.c +1 -1
@@ -265,7 +265,7 @@ static int wm8400_init(struct wm8400 *wm8400,mutex_init (&wm8400->io_lock); - wm8400->dev->driver_data = wm8400; +dev_set_drvdata (wm8400->dev, wm8400);/* Check that this is actually a WM8400 */ ret = wm8400->read_dev (wm8400->io_data,WM8400_RESET_ID ,1 , ®);
Signature · 1 line
1.6.3.2
PATCH 45/64 PCIE: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/pci/pcie/portdrv_core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pci/pcie/portdrv_core.c +1 -1
@@ -275,7 +275,7 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev,memset (device,0 ,sizeof (struct device )); device->bus = &pcie_port_bus_type; device->driver =NULL ; - device->driver_data =NULL ; +dev_set_drvdata (device,NULL ); device->release = release_pcie_device;/* callback to free pcie dev */ dev_set_name (device,"%s:pcie%02x" ,pci_name (parent),get_descriptor_id (port_type, service_type));
Signature · 1 line
1.6.3.2
Re: [PATCH 45/64] PCIE: remove driver_data direct access of struct device
Quoted 27 lines · On Mon, 15 Jun 2009 22:46:34 -0700 Greg Kroah-Hartman <[email protected]> wrote:
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.Cc Jesse Barnes <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/pci/pcie/portdrv_core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/drivers/pci/pcie/portdrv_core.cindex e399825..13ffdc3 100644drivers/pci/pcie/portdrv_core.c +1
-1@@ -275,7 +275,7 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev, memset(device, 0, sizeof(structdevice )); device->bus = &pcie_port_bus_type; device->driver =NULL ; - device->driver_data =NULL ; +dev_set_drvdata (device,NULL ); device->release = release_pcie_device;/* callback to free pcie dev */ dev_set_name(device, "%s:pcie%02x", pci_name(parent), get_descriptor_id(port_type,
Quoted 1 line
service_type));
Looks like I already have this one in my linux-next branch, but I think Linus will handle any conflict that arises if this ends up coming from both of us.
Thanks,
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: [PATCH 45/64] PCIE: remove driver_data direct access of struct device
Quoted 27 lines · Jesse Barnes
Quoted 24 lines · On Mon, 15 Jun 2009 22:46:34 -0700 Greg Kroah-Hartman <[email protected]> wrote:
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.Cc Jesse Barnes <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/pci/pcie/portdrv_core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/drivers/pci/pcie/portdrv_core.cindex e399825..13ffdc3 100644drivers/pci/pcie/portdrv_core.c +1
-1@@ -275,7 +275,7 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev, memset(device, 0, sizeof(structdevice )); device->bus = &pcie_port_bus_type; device->driver =NULL ; - device->driver_data =NULL ; +dev_set_drvdata (device,NULL );
Quoted 8 lines
Quoted 4 lines
drivers/pci/pcie/portdrv_core.c +0
-0device->release = release_pcie_device;/* callback to free pcie dev */ dev_set_name(device, "%s:pcie%02x", pci_name(parent), get_descriptor_id(port_type,
service_type));Looks like I already have this one in my linux-next branch, but I think Linus will handle any conflict that arises if this ends up coming from both of us.
Yes, it should be a trivial merge.
thanks,
greg k-h
PATCH 46/64 pcmcia: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/pcmcia/ds.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/pcmcia/ds.c +4 -4
@@ -394,7 +394,7 @@ static int pcmcia_device_probe(struct device * dev) p_drv =to_pcmcia_drv (dev->driver); s = p_dev->socket; -/* The PCMCIA code passes the match data in via dev->driver_data +/* The PCMCIA code passes the match data in via dev_set_drvdata(dev) * which is an ugly hack. Once the driver probe is called it may * and often will overwrite the match data so we must save it first *
@@ -404,7 +404,7 @@ static int pcmcia_device_probe(struct device * dev)* call which will then check whether there are two * pseudo devices, and if not, add the second one. */ - did = p_dev->dev.driver_data; + did =dev_get_drvdata (&p_dev->dev);ds_dev_dbg (1 , dev,"trying to bind to %s\n" , p_drv->drv.name);
@@ -499,7 +499,7 @@ static int pcmcia_device_remove(struct device * dev)* pseudo multi-function card, we need to unbind * all devices */ - did = p_dev->dev.driver_data; + did =dev_get_drvdata (&p_dev->dev);if (did && (did->match_flags &PCMCIA_DEV_ID_MATCH_DEVICE_NO ) && (p_dev->socket->device_count !=0 ) && (p_dev->device_no ==0 ))
@@ -978,7 +978,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,return 0 ; } - dev->dev.driver_data = (void *) did; +dev_set_drvdata (&dev->dev, did);return 1 ; }
Signature · 1 line
1.6.3.2
PATCH 47/64 scsi: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/scsi/aha1740.c | 2 +- drivers/scsi/libsrp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aha1740.c +1 -1
@@ -646,7 +646,7 @@ static int aha1740_probe (struct device *dev) static __devexit int aha1740_remove (struct device *dev) { -struct Scsi_Host *shpnt = dev->driver_data; +struct Scsi_Host *shpnt =dev_get_drvdata (dev);struct aha1740_hostdata *host =HOSTDATA (shpnt);scsi_remove_host (shpnt);
drivers/scsi/libsrp.c +1 -1
@@ -135,7 +135,7 @@ int srp_target_alloc(struct srp_target *target, struct device *dev,INIT_LIST_HEAD (&target->cmd_queue); target->dev = dev; - target->dev->driver_data = target; +dev_set_drvdata (target->dev, target); target->srp_iu_size = iu_size; target->rx_ring_size = nr;
Signature · 1 line
1.6.3.2
PATCH 48/64 thermal: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/thermal/thermal_sys.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/thermal_sys.c +2 -2
@@ -417,7 +417,7 @@ static LIST_HEAD(thermal_hwmon_list);static ssize_t name_show (struct device *dev,struct device_attribute *attr,char *buf) { -struct thermal_hwmon_device *hwmon = dev->driver_data; +struct thermal_hwmon_device *hwmon =dev_get_drvdata (dev);return sprintf (buf,"%s\n" , hwmon->type); } static DEVICE_ATTR(name, 0444, name_show, NULL);
@@ -488,7 +488,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) result =PTR_ERR (hwmon->device); goto free_mem; } - hwmon->device->driver_data = hwmon; +dev_set_drvdata (hwmon->device, hwmon); result =device_create_file (hwmon->device, &dev_attr_name);if (result) goto unregister_hwmon_device;
Signature · 1 line
1.6.3.2
PATCH 49/64 xen block: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/block/xen-blkfront.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/block/xen-blkfront.c +7 -7
@@ -753,12 +753,12 @@ static int blkfront_probe(struct xenbus_device *dev,/* Front end dir is a number, which is used as the id. */ info->handle =simple_strtoul (strrchr (dev->nodename,'/' )+1 ,NULL ,0 ); - dev->dev.driver_data = info; +dev_set_drvdata (&dev->dev, info); err =talk_to_backend (dev, info);if (err) {kfree (info); - dev->dev.driver_data =NULL ; +dev_set_drvdata (&dev->dev,NULL );return err; }
@@ -843,7 +843,7 @@ static int blkif_recover(struct blkfront_info *info)*/ static int blkfront_resume (struct xenbus_device *dev) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);int err;dev_dbg (&dev->dev,"blkfront_resume: %s\n" , dev->nodename);
@@ -922,7 +922,7 @@ static void blkfront_connect(struct blkfront_info *info)*/ static void blkfront_closing (struct xenbus_device *dev) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);unsigned long flags;dev_dbg (&dev->dev,"blkfront_closing: %s removed\n" , dev->nodename);
@@ -957,7 +957,7 @@ static void blkfront_closing(struct xenbus_device *dev)static void backend_changed (struct xenbus_device *dev,enum xenbus_state backend_state) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);struct block_device *bd;dev_dbg (&dev->dev,"blkfront:backend_changed.\n" );
@@ -997,7 +997,7 @@ static void backend_changed(struct xenbus_device *dev,static int blkfront_remove (struct xenbus_device *dev) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);dev_dbg (&dev->dev,"blkfront_remove: %s removed\n" , dev->nodename);
@@ -1010,7 +1010,7 @@ static int blkfront_remove(struct xenbus_device *dev)static int blkfront_is_ready (struct xenbus_device *dev) { -struct blkfront_info *info = dev->dev.driver_data; +struct blkfront_info *info =dev_get_drvdata (&dev->dev);return info->is_ready; }
Signature · 1 line
1.6.3.2
PATCH 50/64 hvcs: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/char/hvcs.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/char/hvcs.c +3 -3
@@ -347,7 +347,7 @@ static void __exit hvcs_module_exit(void);static inline struct hvcs_struct *from_vio_dev (struct vio_dev *viod) { -return viod->dev.driver_data; +return dev_get_drvdata (&viod->dev); }/* The sysfs interface for the driver and devices */
@@ -785,7 +785,7 @@ static int __devinit hvcs_probe(kref_init (&hvcsd->kref); hvcsd->vdev = dev; - dev->dev.driver_data = hvcsd; +dev_set_drvdata (&dev->dev, hvcsd); hvcsd->index = index;
@@ -831,7 +831,7 @@ static int __devinit hvcs_probe( static int __devexit hvcs_remove(struct vio_dev *dev) { -struct hvcs_struct *hvcsd = dev->dev.driver_data; +struct hvcs_struct *hvcsd =dev_get_drvdata (&dev->dev);unsigned long flags;struct tty_struct *tty;
Signature · 1 line
1.6.3.2
PATCH 51/64 ibmvscsi: gadget: at91_udc: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/scsi/ibmvscsi/ibmvscsi.c | 6 +++--- drivers/scsi/ibmvscsi/ibmvstgt.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/ibmvscsi/ibmvscsi.c +3 -3
@@ -1877,7 +1877,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)unsigned long wait_switch =0 ;int rc; - vdev->dev.driver_data =NULL ; +dev_set_drvdata (&vdev->dev,NULL ); host =scsi_host_alloc (&driver_template,sizeof (*hostdata));if (!host) {
@@ -1949,7 +1949,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)scsi_scan_host (host); } - vdev->dev.driver_data = hostdata; +dev_set_drvdata (&vdev->dev, hostdata);return 0 ; add_srp_port_failed:
@@ -1968,7 +1968,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)static int ibmvscsi_remove (struct vio_dev *vdev) { -struct ibmvscsi_host_data *hostdata = vdev->dev.driver_data; +struct ibmvscsi_host_data *hostdata =dev_get_drvdata (&vdev->dev);unmap_persist_bufs (hostdata);release_event_pool (&hostdata->pool, hostdata); ibmvscsi_ops->release_crq_queue(&hostdata->queue, hostdata,
drivers/scsi/ibmvscsi/ibmvstgt.c +1 -1
@@ -892,7 +892,7 @@ free_vport:static int ibmvstgt_remove (struct vio_dev *dev) { -struct srp_target *target = (struct srp_target *) dev->dev.driver_data; +struct srp_target *target =dev_get_drvdata (&dev->dev);struct Scsi_Host *shost = target->shost;struct vio_port *vport = target->ldata;
Signature · 1 line
1.6.3.2
PATCH 52/64 infiniband: ehca: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/infiniband/hw/ehca/ehca_main.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/ehca/ehca_main.c +4 -4
@@ -636,7 +636,7 @@ static ssize_t ehca_show_##name(struct device *dev, \struct hipz_query_hca *rblock; \int data; \ \ - shca = dev->driver_data; \ + shca =dev_get_drvdata (dev); \ \ rblock =ehca_alloc_fw_ctrlblock (GFP_KERNEL ); \if (!rblock) { \
@@ -680,7 +680,7 @@ static ssize_t ehca_show_adapter_handle(struct device *dev,struct device_attribute *attr, char *buf) { - struct ehca_shca *shca = dev->driver_data; + struct ehca_shca *shca = dev_get_drvdata(dev);return sprintf (buf,"%llx\n" , shca->ipz_hca_handle.handle);
@@ -749,7 +749,7 @@ static int __devinit ehca_probe(struct of_device *dev, shca->ofdev = dev; shca->ipz_hca_handle.handle = *handle; - dev->dev.driver_data = shca; +dev_set_drvdata (&dev->dev, shca); ret =ehca_sense_attributes (shca);if (ret <0 ) {
@@ -878,7 +878,7 @@ probe1: static int __devexit ehca_remove(struct of_device *dev) { -struct ehca_shca *shca = dev->dev.driver_data; +struct ehca_shca *shca =dev_get_drvdata (&dev->dev);unsigned long flags;int ret;
Signature · 1 line
1.6.3.2
PATCH 53/64 ipmi: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/char/ipmi/ipmi_si_intf.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +2 -2
@@ -2375,14 +2375,14 @@ static int __devinit ipmi_of_probe(struct of_device *dev, info->io.addr_data, info->io.regsize, info->io.regspacing, info->irq); - dev->dev.driver_data = (void *) info; +dev_set_drvdata (&dev->dev, info);return try_smi_init (info); } static int __devexit ipmi_of_remove(struct of_device *dev) { -cleanup_one_si (dev->dev.driver_data); +cleanup_one_si (dev_get_drvdata (&dev->dev));return 0 ; }
Signature · 1 line
1.6.3.2
PATCH 54/64 mips: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- arch/mips/sni/eisa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/mips/sni/eisa.c +1 -1
@@ -38,7 +38,7 @@ int __init sni_eisa_root_init(void)if (!r)return r; - eisa_root_dev.dev.driver_data = &eisa_bus_root; +dev_set_drvdata (&eisa_root_dev.dev, &eisa_bus_root);if (eisa_root_register (&eisa_bus_root)) {/* A real bridge may have been registered before
Signature · 1 line
1.6.3.2
Ralf Baechle
AppliedRe: [PATCH 54/64] mips: remove driver_data direct access of struct device
Quoted 9 lines · Greg Kroah-Hartman
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.Cc Ralf Baechle <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Thanks, applied.
Ralf
Re: [PATCH 54/64] mips: remove driver_data direct access of struct device
Quoted 8 lines · Ralf Baechle
Quoted 6 lines · Greg Kroah-Hartman
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
Quoted 5 lines
Quoted 3 lines
Cc Ralf Baechle <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Thanks, applied.
Heh, I sent this a while ago to you :)
This was the "here's what just got sent to Linus" series of patches.
thanks,
greg k-h
PATCH 55/64 of_serial: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/serial/of_serial.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/serial/of_serial.c +2 -2
@@ -122,7 +122,7 @@ static int __devinit of_platform_serial_probe(struct of_device *ofdev, info->type = port_type; info->line = ret; - ofdev->dev.driver_data = info; +dev_set_drvdata (&ofdev->dev, info);return 0 ; out:kfree (info);
@@ -135,7 +135,7 @@ out:*/ static int of_platform_serial_remove (struct of_device *ofdev) { -struct of_serial_info *info = ofdev->dev.driver_data; +struct of_serial_info *info =dev_get_drvdata (&ofdev->dev);switch (info->type) {#ifdef CONFIG_SERIAL_8250 case PORT_8250 ... PORT_MAX_8250:
Signature · 1 line
1.6.3.2
PATCH 56/64 parisc: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/parisc/eisa.c | 2 +- drivers/parisc/sba_iommu.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/parisc/eisa.c +1 -1
@@ -373,7 +373,7 @@ static int __init eisa_probe(struct parisc_device *dev)if (result >=0 ) {/* FIXME : Don't enumerate the bus twice. */ eisa_dev.root.dev = &dev->dev; - dev->dev.driver_data = &eisa_dev.root; +dev_set_drvdata (&dev->dev, &eisa_dev.root); eisa_dev.root.bus_base_addr =0 ; eisa_dev.root.res = &eisa_dev.hba.io_space; eisa_dev.root.slots = result;
drivers/parisc/sba_iommu.c +3 -3
@@ -2010,7 +2010,7 @@ void __init sba_init(void)void *sba_get_iommu (struct parisc_device *pci_hba) {struct parisc_device *sba_dev =parisc_parent (pci_hba); -struct sba_device *sba = sba_dev->dev.driver_data; +struct sba_device *sba =dev_get_drvdata (&sba_dev->dev);char t = sba_dev->id.hw_type;int iocnum = (pci_hba->hw_path >>3 );/* rope # */
@@ -2031,7 +2031,7 @@ void * sba_get_iommu(struct parisc_device *pci_hba)void sba_directed_lmmio (struct parisc_device *pci_hba,struct resource *r) {struct parisc_device *sba_dev =parisc_parent (pci_hba); -struct sba_device *sba = sba_dev->dev.driver_data; +struct sba_device *sba =dev_get_drvdata (&sba_dev->dev);char t = sba_dev->id.hw_type;int i;int rope = (pci_hba->hw_path & (ROPES_PER_IOC -1 ));/* rope # */
@@ -2073,7 +2073,7 @@ void sba_directed_lmmio(struct parisc_device *pci_hba, struct resource *r)void sba_distributed_lmmio (struct parisc_device *pci_hba,struct resource *r ) {struct parisc_device *sba_dev =parisc_parent (pci_hba); -struct sba_device *sba = sba_dev->dev.driver_data; +struct sba_device *sba =dev_get_drvdata (&sba_dev->dev);char t = sba_dev->id.hw_type;int base, size;int rope = (pci_hba->hw_path & (ROPES_PER_IOC -1 ));/* rope # */
Signature · 1 line
1.6.3.2
Re: [PATCH 56/64] parisc: remove driver_data direct access of struct device
Quoted 9 lines · Greg Kroah-Hartman
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.Cc Helge Deller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Do you want to push it along with the rest of them, or would you like me to apply it?
regards, Kyle
Re: [PATCH 56/64] parisc: remove driver_data direct access of struct device
Quoted 7 lines · Kyle McMartin
Quoted 6 lines · Greg Kroah-Hartman
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
Quoted 8 lines
Quoted 3 lines
Cc Helge Deller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Acked-by Kyle McMartin <[email protected]>Do you want to push it along with the rest of them, or would you like me to apply it?
This was sent a while ago, and is going to Linus right now. So if you want to also add it to your tree, so that it is sure to not get lost, that is fine with me :)
thanks,
greg k-h
Re: [PATCH 56/64] parisc: remove driver_data direct access of struct device
Quoted 12 lines · Greg KH
Quoted 11 lines · Kyle McMartin
Quoted 9 lines · Greg Kroah-Hartman
In the near future, the driver core is going to not allow direct access to the
driver_datapointer in struct device. Instead, the functionsdev_get_drvdata()anddev_set_drvdata()should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.Cc Helge Deller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 9 lines
Quoted 4 lines
Acked-by Kyle McMartin <[email protected]>Do you want to push it along with the rest of them, or would you like me to apply it?
This was sent a while ago, and is going to Linus right now. So if you want to also add it to your tree, so that it is sure to not get lost, that is fine with me :)
Ah, it probably already was, but I've been so busy in the last month or two that I missed sending anything after .30-rc$early. (I only asked because Linus wasn't on the CC so I figured it was out for review again, or something.)
cheers, Kyle
PATCH 57/64 parport: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/parport/parport_gsc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/parport/parport_gsc.c +2 -2
@@ -376,14 +376,14 @@ static int __devinit parport_init_chip(struct parisc_device *dev) /* PARPORT_IRQ_NONE */ PARPORT_DMA_NONE, NULL);if (p) parport_count++; - dev->dev.driver_data = p; +dev_set_drvdata (&dev->dev, p);return 0 ; } static int __devexit parport_remove_chip(struct parisc_device *dev) { -struct parport *p = dev->dev.driver_data; +struct parport *p =dev_get_drvdata (&dev->dev);if (p) {struct parport_gsc_private *priv = p->private_data;struct parport_operations *ops = p->ops;
Signature · 1 line
1.6.3.2
PATCH 58/64 s390: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
Thanks to Sebastian Ott <[email protected]> for fixing a few typos in my original version of this patch.
--- drivers/s390/char/con3215.c | 16 ++++++------ drivers/s390/char/raw3270.c | 16 ++++++------ drivers/s390/char/tape_34xx.c | 2 +- drivers/s390/char/tape_3590.c | 2 +- drivers/s390/char/tape_core.c | 22 ++++++++-------- drivers/s390/char/vmlogrdr.c | 12 ++++---- drivers/s390/char/vmur.c | 16 ++++++------ drivers/s390/net/claw.c | 52 ++++++++++++++++++++-------------------- drivers/s390/net/lcs.c | 20 ++++++++-------- drivers/s390/net/lcs.h | 4 +- drivers/s390/net/netiucv.c | 47 +++++++++++++++++++------------------ 11 files changed, 105 insertions(+), 104 deletions(-)
drivers/s390/char/con3215.c +8 -8
@@ -368,7 +368,7 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)int cstat, dstat;int count; - raw = cdev->dev.driver_data; + raw =dev_get_drvdata (&cdev->dev); req = (struct raw3215_req *) intparm; cstat = irb->scsw.cmd.cstat; dstat = irb->scsw.cmd.dstat;
@@ -635,7 +635,7 @@ raw3215_probe (struct ccw_device *cdev)int line;/* Console is special. */ -if (raw3215[0 ] && (cdev->dev.driver_data == raw3215[0 ])) +if (raw3215[0 ] && (raw3215[0 ] ==dev_get_drvdata (&cdev->dev)))return 0 ; raw =kmalloc (sizeof (struct raw3215_info ) +RAW3215_INBUF_SIZE ,GFP_KERNEL |GFP_DMA );
@@ -669,7 +669,7 @@ raw3215_probe (struct ccw_device *cdev) }init_waitqueue_head (&raw->empty_wait); - cdev->dev.driver_data = raw; +dev_set_drvdata (&cdev->dev, raw); cdev->handler = raw3215_irq;return 0 ;
@@ -681,9 +681,9 @@ raw3215_remove (struct ccw_device *cdev)struct raw3215_info *raw;ccw_device_set_offline (cdev); - raw = cdev->dev.driver_data; + raw =dev_get_drvdata (&cdev->dev);if (raw) { - cdev->dev.driver_data =NULL ; +dev_set_drvdata (&cdev->dev,NULL );kfree (raw->buffer);kfree (raw); }
@@ -694,7 +694,7 @@ raw3215_set_online (struct ccw_device *cdev) {struct raw3215_info *raw; - raw = cdev->dev.driver_data; + raw =dev_get_drvdata (&cdev->dev);if (!raw)return -ENODEV ;
@@ -706,7 +706,7 @@ raw3215_set_offline (struct ccw_device *cdev) {struct raw3215_info *raw; - raw = cdev->dev.driver_data; + raw =dev_get_drvdata (&cdev->dev);if (!raw)return -ENODEV ;
@@ -848,7 +848,7 @@ con3215_init(void) raw->buffer = (char *)alloc_bootmem_low (RAW3215_BUFFER_SIZE ); raw->inbuf = (char *)alloc_bootmem_low (RAW3215_INBUF_SIZE ); raw->cdev = cdev; - cdev->dev.driver_data = raw; +dev_set_drvdata (&cdev->dev, raw); cdev->handler = raw3215_irq; raw->flags |=RAW3215_FIXED ;
drivers/s390/char/raw3270.c +8 -8
@@ -355,7 +355,7 @@ raw3270_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)struct raw3270_request *rq;int rc; - rp = (struct raw3270 *) cdev->dev.driver_data; + rp =dev_get_drvdata (&cdev->dev);if (!rp)return ; rq = (struct raw3270_request *) intparm;
@@ -828,7 +828,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)if (rp->minor ==-1 )return -EUSERS ; rp->cdev = cdev; - cdev->dev.driver_data = rp; +dev_set_drvdata (&cdev->dev, rp); cdev->handler = raw3270_irq;return 0 ; }
@@ -1105,7 +1105,7 @@ raw3270_delete_device(struct raw3270 *rp)/* Disconnect from ccw_device. */ cdev = rp->cdev; rp->cdev =NULL ; - cdev->dev.driver_data =NULL ; +dev_set_drvdata (&cdev->dev,NULL ); cdev->handler =NULL ;/* Put ccw_device structure. */
@@ -1129,7 +1129,7 @@ static ssize_t raw3270_model_show(struct device *dev, struct device_attribute *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%i\n", - ((struct raw3270 *) dev->driver_data)->model); + ((struct raw3270 *) dev_get_drvdata(dev))->model); } static DEVICE_ATTR(model, 0444, raw3270_model_show, NULL);
@@ -1137,7 +1137,7 @@ static ssize_t raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%i\n", - ((struct raw3270 *) dev->driver_data)->rows); + ((struct raw3270 *) dev_get_drvdata(dev))->rows); } static DEVICE_ATTR(rows, 0444, raw3270_rows_show, NULL);
@@ -1145,7 +1145,7 @@ static ssize_t raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%i\n", - ((struct raw3270 *) dev->driver_data)->cols); + ((struct raw3270 *) dev_get_drvdata(dev))->cols); } static DEVICE_ATTR(columns, 0444, raw3270_columns_show, NULL);
@@ -1282,7 +1282,7 @@ raw3270_remove (struct ccw_device *cdev)struct raw3270_view *v;struct raw3270_notifier *np; - rp = cdev->dev.driver_data; + rp =dev_get_drvdata (&cdev->dev);/* * _remove is the opposite of _probe; it's probe that * should set up rp. raw3270_remove gets entered for
@@ -1330,7 +1330,7 @@ raw3270_set_offline (struct ccw_device *cdev) {struct raw3270 *rp; - rp = cdev->dev.driver_data; + rp =dev_get_drvdata (&cdev->dev);if (test_bit (RAW3270_FLAGS_CONSOLE , &rp->flags))return -EBUSY ;raw3270_remove (cdev);
drivers/s390/char/tape_34xx.c +1 -1
@@ -1289,7 +1289,7 @@ static int tape_34xx_online(struct ccw_device *cdev) {return tape_generic_online ( - cdev->dev.driver_data, +dev_get_drvdata (&cdev->dev), &tape_discipline_34xx ); }
drivers/s390/char/tape_3590.c +1 -1
@@ -1703,7 +1703,7 @@ static struct ccw_device_id tape_3590_ids[] = {static int tape_3590_online (struct ccw_device *cdev) { -return tape_generic_online (cdev->dev.driver_data, +return tape_generic_online (dev_get_drvdata (&cdev->dev), &tape_discipline_3590); }
drivers/s390/char/tape_core.c +11 -11
@@ -92,7 +92,7 @@ tape_medium_state_show(struct device *dev, struct device_attribute *attr, char * {struct tape_device *tdev; - tdev = (struct tape_device *) dev->driver_data; + tdev =dev_get_drvdata (dev);return scnprintf (buf,PAGE_SIZE ,"%i\n" , tdev->medium_state); }
@@ -104,7 +104,7 @@ tape_first_minor_show(struct device *dev, struct device_attribute *attr, char *b {struct tape_device *tdev; - tdev = (struct tape_device *) dev->driver_data; + tdev =dev_get_drvdata (dev);return scnprintf (buf,PAGE_SIZE ,"%i\n" , tdev->first_minor); }
@@ -116,7 +116,7 @@ tape_state_show(struct device *dev, struct device_attribute *attr, char *buf) {struct tape_device *tdev; - tdev = (struct tape_device *) dev->driver_data; + tdev =dev_get_drvdata (dev);return scnprintf (buf,PAGE_SIZE ,"%s\n" , (tdev->first_minor <0 ) ?"OFFLINE" : tape_state_verbose[tdev->tape_state]); }
@@ -130,7 +130,7 @@ tape_operation_show(struct device *dev, struct device_attribute *attr, char *bufstruct tape_device *tdev;ssize_t rc; - tdev = (struct tape_device *) dev->driver_data; + tdev =dev_get_drvdata (dev);if (tdev->first_minor <0 )return scnprintf (buf,PAGE_SIZE ,"N/A\n" );
@@ -156,7 +156,7 @@ tape_blocksize_show(struct device *dev, struct device_attribute *attr, char *buf {struct tape_device *tdev; - tdev = (struct tape_device *) dev->driver_data; + tdev =dev_get_drvdata (dev);return scnprintf (buf,PAGE_SIZE ,"%i\n" , tdev->char_data.block_size); }
@@ -391,7 +391,7 @@ tape_generic_offline(struct ccw_device *cdev) {struct tape_device *device; - device = cdev->dev.driver_data; + device =dev_get_drvdata (&cdev->dev);if (!device) {return -ENODEV ; }
@@ -534,7 +534,7 @@ tape_generic_probe(struct ccw_device *cdev)tape_put_device (device);return ret; } - cdev->dev.driver_data = device; +dev_set_drvdata (&cdev->dev, device); cdev->handler = __tape_do_irq; device->cdev = cdev;ccw_device_get_id (cdev, &dev_id);
@@ -573,7 +573,7 @@ tape_generic_remove(struct ccw_device *cdev) {struct tape_device * device; - device = cdev->dev.driver_data; + device =dev_get_drvdata (&cdev->dev);if (!device) {return ; }
@@ -613,9 +613,9 @@ tape_generic_remove(struct ccw_device *cdev)tape_cleanup_device (device); } -if (cdev->dev.driver_data !=NULL ) { +if (!dev_get_drvdata (&cdev->dev)) {sysfs_remove_group (&cdev->dev.kobj, &tape_attr_group); - cdev->dev.driver_data =tape_put_device (cdev->dev.driver_data); +dev_set_drvdata (&cdev->dev,tape_put_device (dev_get_drvdata (&cdev->dev))); } }
@@ -1011,7 +1011,7 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)struct tape_request *request;int rc; - device = (struct tape_device *) cdev->dev.driver_data; + device =dev_get_drvdata (&cdev->dev);if (device ==NULL ) {return ; }
drivers/s390/char/vmlogrdr.c +6 -6
@@ -504,7 +504,7 @@ static ssize_t vmlogrdr_autopurge_store(struct device * dev,struct device_attribute *attr, const char * buf, size_t count) { - struct vmlogrdr_priv_t *priv = dev->driver_data; + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);ssize_t ret = count;switch (buf[0 ]) {
@@ -525,7 +525,7 @@ static ssize_t vmlogrdr_autopurge_show(struct device *dev,struct device_attribute *attr, char *buf) { - struct vmlogrdr_priv_t *priv = dev->driver_data; + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);return sprintf (buf,"%u\n" , priv->autopurge); }
@@ -541,7 +541,7 @@ static ssize_t vmlogrdr_purge_store(struct device * dev,char cp_command[80 ];char cp_response[80 ]; -struct vmlogrdr_priv_t *priv = dev->driver_data; +struct vmlogrdr_priv_t *priv =dev_get_drvdata (dev);if (buf[0 ] !='1' )return -EINVAL ;
@@ -578,7 +578,7 @@ static ssize_t vmlogrdr_autorecording_store(struct device *dev,struct device_attribute *attr, const char *buf, size_t count) { - struct vmlogrdr_priv_t *priv = dev->driver_data; + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);ssize_t ret = count;switch (buf[0 ]) {
@@ -599,7 +599,7 @@ static ssize_t vmlogrdr_autorecording_show(struct device *dev,struct device_attribute *attr, char *buf) { - struct vmlogrdr_priv_t *priv = dev->driver_data; + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);return sprintf (buf,"%u\n" , priv->autorecording); }
@@ -612,7 +612,7 @@ static ssize_t vmlogrdr_recording_store(struct device * dev,struct device_attribute *attr, const char * buf, size_t count) { - struct vmlogrdr_priv_t *priv = dev->driver_data; + struct vmlogrdr_priv_t *priv = dev_get_drvdata(dev);ssize_t ret;switch (buf[0 ]) {
drivers/s390/char/vmur.c +8 -8
@@ -78,11 +78,11 @@ static DEFINE_MUTEX(vmur_mutex);* * Each ur device (urd) contains a reference to its corresponding ccw device * (cdev) using the urd->cdev pointer. Each ccw device has a reference to the -* ur device using the cdev->dev.driver_data pointer. +* ur device using dev_get_drvdata(&cdev->dev) pointer. * * urd references: * - ur_probe gets a urd reference, ur_remove drops the reference -* (cdev->dev.driver_data) +* dev_get_drvdata(&cdev->dev) * - ur_open gets a urd reference, ur_relase drops the reference * (urf->urd) *
@@ -90,7 +90,7 @@ static DEFINE_MUTEX(vmur_mutex);* - urdev_alloc get a cdev reference (urd->cdev) * - urdev_free drops the cdev reference (urd->cdev) * -* Setting and clearing of cdev->dev.driver_data is protected by the ccwdev lock +* Setting and clearing of dev_get_drvdata(&cdev->dev) is protected by the ccwdev lock */ static struct urdev *urdev_alloc (struct ccw_device *cdev) {
@@ -129,7 +129,7 @@ static struct urdev *urdev_get_from_cdev(struct ccw_device *cdev)unsigned long flags;spin_lock_irqsave (get_ccwdev_lock (cdev), flags); - urd = cdev->dev.driver_data; + urd =dev_get_drvdata (&cdev->dev);if (urd)urdev_get (urd);spin_unlock_irqrestore (get_ccwdev_lock (cdev), flags);
@@ -286,7 +286,7 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm,TRACE ("ur_int_handler: unsolicited interrupt\n" );return ; } - urd = cdev->dev.driver_data; + urd =dev_get_drvdata (&cdev->dev);BUG_ON (!urd);/* On special conditions irb is an error pointer */ if (IS_ERR (irb))
@@ -832,7 +832,7 @@ static int ur_probe(struct ccw_device *cdev) goto fail_remove_attr; }spin_lock_irq (get_ccwdev_lock (cdev)); - cdev->dev.driver_data = urd; +dev_set_drvdata (&cdev->dev, urd);spin_unlock_irq (get_ccwdev_lock (cdev));mutex_unlock (&vmur_mutex);
@@ -972,8 +972,8 @@ static void ur_remove(struct ccw_device *cdev)ur_remove_attributes (&cdev->dev);spin_lock_irqsave (get_ccwdev_lock (cdev), flags); -urdev_put (cdev->dev.driver_data); - cdev->dev.driver_data =NULL ; +urdev_put (dev_get_drvdata (&cdev->dev)); +dev_set_drvdata (&cdev->dev,NULL );spin_unlock_irqrestore (get_ccwdev_lock (cdev), flags);mutex_unlock (&vmur_mutex);
drivers/s390/net/claw.c +26 -26
167 lines not on this page · raw message
drivers/s390/net/lcs.c +10 -10
@@ -1939,7 +1939,7 @@ lcs_portno_show (struct device *dev, struct device_attribute *attr, char *buf) {struct lcs_card *card; - card = (struct lcs_card *)dev->driver_data; + card =dev_get_drvdata (dev);if (!card)return 0 ;
@@ -1956,7 +1956,7 @@ lcs_portno_store (struct device *dev, struct device_attribute *attr, const charstruct lcs_card *card;int value; - card = (struct lcs_card *)dev->driver_data; + card =dev_get_drvdata (dev);if (!card)return 0 ;
@@ -1990,7 +1990,7 @@ lcs_timeout_show(struct device *dev, struct device_attribute *attr, char *buf) {struct lcs_card *card; - card = (struct lcs_card *)dev->driver_data; + card =dev_get_drvdata (dev);return card ?sprintf (buf,"%u\n" , card->lancmd_timeout) :0 ; }
@@ -2001,7 +2001,7 @@ lcs_timeout_store (struct device *dev, struct device_attribute *attr, const charstruct lcs_card *card;int value; - card = (struct lcs_card *)dev->driver_data; + card =dev_get_drvdata (dev);if (!card)return 0 ;
@@ -2020,7 +2020,7 @@ static ssize_t lcs_dev_recover_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct lcs_card *card = dev->driver_data; + struct lcs_card *card = dev_get_drvdata(dev);char *tmp;int i;
@@ -2073,7 +2073,7 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)put_device (&ccwgdev->dev);return ret; } - ccwgdev->dev.driver_data = card; +dev_set_drvdata (&ccwgdev->dev, card); ccwgdev->cdev[0 ]->handler = lcs_irq; ccwgdev->cdev[1 ]->handler = lcs_irq; card->gdev = ccwgdev;
@@ -2090,7 +2090,7 @@ lcs_register_netdev(struct ccwgroup_device *ccwgdev)struct lcs_card *card;LCS_DBF_TEXT (2 , setup,"regnetdv" ); - card = (struct lcs_card *)ccwgdev->dev.driver_data; + card =dev_get_drvdata (&ccwgdev->dev);if (card->dev->reg_state !=NETREG_UNINITIALIZED )return 0 ;SET_NETDEV_DEV (card->dev, &ccwgdev->dev);
@@ -2123,7 +2123,7 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)enum lcs_dev_states recover_state;int rc; - card = (struct lcs_card *)ccwgdev->dev.driver_data; + card =dev_get_drvdata (&ccwgdev->dev);if (!card)return -ENODEV ;
@@ -2229,7 +2229,7 @@ __lcs_shutdown_device(struct ccwgroup_device *ccwgdev, int recovery_mode)int ret;LCS_DBF_TEXT (3 , setup,"shtdndev" ); - card = (struct lcs_card *)ccwgdev->dev.driver_data; + card =dev_get_drvdata (&ccwgdev->dev);if (!card)return -ENODEV ;if (recovery_mode ==0 ) {
@@ -2296,7 +2296,7 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev) {struct lcs_card *card; - card = (struct lcs_card *)ccwgdev->dev.driver_data; + card =dev_get_drvdata (&ccwgdev->dev);if (!card)return ;
drivers/s390/net/lcs.h +2 -2
@@ -34,8 +34,8 @@ static inline int lcs_dbf_passes(debug_info_t *dbf_grp, int level)* sysfs related stuff */ #define CARD_FROM_DEV (cdev) \ - (struct lcs_card *) \ - ((struct ccwgroup_device *)cdev->dev.driver_data)->dev.driver_data; + (struct lcs_card *) dev_get_drvdata( \ + &((struct ccwgroup_device *)dev_get_drvdata(&cdev->dev))->dev);/** * CCW commands used in this driver */
drivers/s390/net/netiucv.c +24 -23
185 lines not on this page · raw message
Signature · 1 line
1.6.3.2
PATCH 59/64 block/ps3: remove driver_data direct access of struct device
In reply to Greg KHFrom: Roel Kluin <[email protected]>
In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/block/ps3disk.c | 18 +++++++++--------- drivers/block/ps3vram.c | 46 +++++++++++++++++++++++----------------------- 2 files changed, 32 insertions(+), 32 deletions(-)
drivers/block/ps3disk.c +9 -9
@@ -120,7 +120,7 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev,static int ps3disk_submit_request_sg (struct ps3_storage_device *dev,struct request *req) { -struct ps3disk_private *priv = dev->sbd.core.driver_data; +struct ps3disk_private *priv =dev_get_drvdata (&dev->sbd.core);int write =rq_data_dir (req), res;const char *op = write ?"write" :"read" ;u64 start_sector, sectors;
@@ -168,7 +168,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,static int ps3disk_submit_flush_request (struct ps3_storage_device *dev,struct request *req) { -struct ps3disk_private *priv = dev->sbd.core.driver_data; +struct ps3disk_private *priv =dev_get_drvdata (&dev->sbd.core);u64 res;dev_dbg (&dev->sbd.core,"%s:%u: flush request\n" , __func__, __LINE__);
@@ -213,7 +213,7 @@ static void ps3disk_do_request(struct ps3_storage_device *dev,static void ps3disk_request (struct request_queue *q) {struct ps3_storage_device *dev = q->queuedata; -struct ps3disk_private *priv = dev->sbd.core.driver_data; +struct ps3disk_private *priv =dev_get_drvdata (&dev->sbd.core);if (priv->req) {dev_dbg (&dev->sbd.core,"%s:%u busy\n" , __func__, __LINE__);
@@ -245,7 +245,7 @@ static irqreturn_t ps3disk_interrupt(int irq, void *data)return IRQ_HANDLED ; } - priv = dev->sbd.core.driver_data; + priv =dev_get_drvdata (&dev->sbd.core); req = priv->req;if (!req) { dev_dbg(&dev->sbd.core,
@@ -364,7 +364,7 @@ static void ata_id_c_string(const u16 *id, unsigned char *s, unsigned int ofs,static int ps3disk_identify (struct ps3_storage_device *dev) { -struct ps3disk_private *priv = dev->sbd.core.driver_data; +struct ps3disk_private *priv =dev_get_drvdata (&dev->sbd.core);struct lv1_ata_cmnd_block ata_cmnd;u16 *id = dev->bounce_buf;u64 res;
@@ -445,7 +445,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) goto fail; } - dev->sbd.core.driver_data = priv; +dev_set_drvdata (&dev->sbd.core, priv);spin_lock_init (&priv->lock); dev->bounce_size =BOUNCE_SIZE ;
@@ -523,7 +523,7 @@ fail_free_bounce:kfree (dev->bounce_buf); fail_free_priv:kfree (priv); - dev->sbd.core.driver_data =NULL ; +dev_set_drvdata (&dev->sbd.core,NULL ); fail:mutex_lock (&ps3disk_mask_mutex);__clear_bit (devidx, &ps3disk_mask);
@@ -534,7 +534,7 @@ fail:static int ps3disk_remove (struct ps3_system_bus_device *_dev) {struct ps3_storage_device *dev =to_ps3_storage_device (&_dev->core); -struct ps3disk_private *priv = dev->sbd.core.driver_data; +struct ps3disk_private *priv =dev_get_drvdata (&dev->sbd.core);mutex_lock (&ps3disk_mask_mutex); __clear_bit(MINOR(disk_devt(priv->gendisk)) / PS3DISK_MINORS,
@@ -548,7 +548,7 @@ static int ps3disk_remove(struct ps3_system_bus_device *_dev)ps3stor_teardown (dev);kfree (dev->bounce_buf);kfree (priv); - dev->sbd.core.driver_data =NULL ; +dev_set_drvdata (&dev->sbd.core,NULL );return 0 ; }
drivers/block/ps3vram.c +23 -23
179 lines not on this page · raw message
Signature · 1 line
1.6.3.2
PATCH 60/64 uml: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- arch/um/drivers/net_kern.c | 4 ++-- arch/um/drivers/ubd_kern.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/um/drivers/net_kern.c +2 -2
@@ -360,7 +360,7 @@ static struct platform_driver uml_net_driver = {static void net_device_release (struct device *dev) { -struct uml_net *device = dev->driver_data; +struct uml_net *device =dev_get_drvdata (dev);struct net_device *netdev = device->dev;struct uml_net_private *lp =netdev_priv (netdev);
@@ -440,7 +440,7 @@ static void eth_configure(int n, void *init, char *mac, device->pdev.id = n; device->pdev.name =DRIVER_NAME ; device->pdev.dev.release = net_device_release; - device->pdev.dev.driver_data = device; +dev_set_drvdata (&device->pdev.dev, device);if (platform_device_register (&device->pdev)) goto out_free_netdev;SET_NETDEV_DEV (dev,&device->pdev.dev);
arch/um/drivers/ubd_kern.c +2 -2
@@ -778,7 +778,7 @@ static int ubd_open_dev(struct ubd *ubd_dev)static void ubd_device_release (struct device *dev) { -struct ubd *ubd_dev = dev->driver_data; +struct ubd *ubd_dev =dev_get_drvdata (dev);blk_cleanup_queue (ubd_dev->queue); *ubd_dev = ((struct ubd )DEFAULT_UBD );
@@ -807,7 +807,7 @@ static int ubd_disk_register(int major, u64 size, int unit, ubd_devs[unit].pdev.id = unit; ubd_devs[unit].pdev.name =DRIVER_NAME ; ubd_devs[unit].pdev.dev.release = ubd_device_release; - ubd_devs[unit].pdev.dev.driver_data = &ubd_devs[unit]; +dev_set_drvdata (&ubd_devs[unit].pdev.dev, &ubd_devs[unit]);platform_device_register (&ubd_devs[unit].pdev); disk->driverfs_dev = &ubd_devs[unit].pdev.dev; }
Signature · 13 lines
1.6.3.2 ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
PATCH 61/64 usb: gadget: at91_udc: remove driver_data direct access of struct device
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/usb/gadget/at91_udc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/at91_udc.c +3 -3
@@ -1574,7 +1574,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver) udc->driver = driver; udc->gadget.dev.driver = &driver->driver; - udc->gadget.dev.driver_data = &driver->driver; +dev_set_drvdata (&udc->gadget.dev, &driver->driver); udc->enabled =1 ; udc->selfpowered =1 ;
@@ -1583,7 +1583,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)DBG ("driver->bind() returned %d\n" , retval); udc->driver =NULL ; udc->gadget.dev.driver =NULL ; - udc->gadget.dev.driver_data =NULL ; +dev_set_drvdata (&udc->gadget.dev,NULL ); udc->enabled =0 ; udc->selfpowered =0 ;return retval;
@@ -1613,7 +1613,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) driver->unbind (&udc->gadget); udc->gadget.dev.driver =NULL ; - udc->gadget.dev.driver_data =NULL ; +dev_set_drvdata (&udc->gadget.dev,NULL ); udc->driver =NULL ;DBG ("unbound from %s\n" , driver->driver.name);
Signature · 1 line
1.6.3.2
PATCH 62/64 xen: remove driver_data direct access of struct device from more drivers
In reply to Greg KHIn the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions.
--- drivers/input/xen-kbdfront.c | 8 ++++---- drivers/net/xen-netfront.c | 10 +++++----- drivers/video/xen-fbfront.c | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/input/xen-kbdfront.c +4 -4
@@ -114,7 +114,7 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev,xenbus_dev_fatal (dev, -ENOMEM ,"allocating info structure" );return -ENOMEM ; } - dev->dev.driver_data = info; +dev_set_drvdata (&dev->dev, info); info->xbdev = dev; info->irq =-1 ;snprintf (info->phys,sizeof (info->phys),"xenbus/%s" , dev->nodename);
@@ -186,7 +186,7 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev,static int xenkbd_resume (struct xenbus_device *dev) { -struct xenkbd_info *info = dev->dev.driver_data; +struct xenkbd_info *info =dev_get_drvdata (&dev->dev);xenkbd_disconnect_backend (info);memset (info->page,0 ,PAGE_SIZE );
@@ -195,7 +195,7 @@ static int xenkbd_resume(struct xenbus_device *dev)static int xenkbd_remove (struct xenbus_device *dev) { -struct xenkbd_info *info = dev->dev.driver_data; +struct xenkbd_info *info =dev_get_drvdata (&dev->dev);xenkbd_disconnect_backend (info);if (info->kbd)
@@ -266,7 +266,7 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)static void xenkbd_backend_changed (struct xenbus_device *dev,enum xenbus_state backend_state) { -struct xenkbd_info *info = dev->dev.driver_data; +struct xenkbd_info *info =dev_get_drvdata (&dev->dev);int ret, val;switch (backend_state) {
drivers/net/xen-netfront.c +5 -5
@@ -1212,7 +1212,7 @@ static int __devinit netfront_probe(struct xenbus_device *dev, } info =netdev_priv (netdev); - dev->dev.driver_data = info; +dev_set_drvdata (&dev->dev, info); err =register_netdev (info->netdev);if (err) {
@@ -1233,7 +1233,7 @@ static int __devinit netfront_probe(struct xenbus_device *dev, fail:free_netdev (netdev); - dev->dev.driver_data =NULL ; +dev_set_drvdata (&dev->dev,NULL );return err; }
@@ -1275,7 +1275,7 @@ static void xennet_disconnect_backend(struct netfront_info *info)*/ static int netfront_resume (struct xenbus_device *dev) { -struct netfront_info *info = dev->dev.driver_data; +struct netfront_info *info =dev_get_drvdata (&dev->dev);dev_dbg (&dev->dev,"%s\n" , dev->nodename);
@@ -1600,7 +1600,7 @@ static int xennet_connect(struct net_device *dev)static void backend_changed (struct xenbus_device *dev,enum xenbus_state backend_state) { -struct netfront_info *np = dev->dev.driver_data; +struct netfront_info *np =dev_get_drvdata (&dev->dev);struct net_device *netdev = np->netdev;dev_dbg (&dev->dev,"%s\n" ,xenbus_strstate (backend_state));
@@ -1774,7 +1774,7 @@ static struct xenbus_device_id netfront_ids[] = { static int __devexit xennet_remove(struct xenbus_device *dev) { -struct netfront_info *info = dev->dev.driver_data; +struct netfront_info *info =dev_get_drvdata (&dev->dev);dev_dbg (&dev->dev,"%s\n" , dev->nodename);
drivers/video/xen-fbfront.c +4 -4
@@ -384,7 +384,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, fb_size =XENFB_DEFAULT_FB_LEN ; } - dev->dev.driver_data = info; +dev_set_drvdata (&dev->dev, info); info->xbdev = dev; info->irq =-1 ; info->x1 = info->y1 =INT_MAX ;
@@ -503,7 +503,7 @@ xenfb_make_preferred_console(void)static int xenfb_resume (struct xenbus_device *dev) { -struct xenfb_info *info = dev->dev.driver_data; +struct xenfb_info *info =dev_get_drvdata (&dev->dev);xenfb_disconnect_backend (info);xenfb_init_shared_page (info, info->fb_info);
@@ -512,7 +512,7 @@ static int xenfb_resume(struct xenbus_device *dev)static int xenfb_remove (struct xenbus_device *dev) { -struct xenfb_info *info = dev->dev.driver_data; +struct xenfb_info *info =dev_get_drvdata (&dev->dev);xenfb_disconnect_backend (info);if (info->fb_info) {
@@ -621,7 +621,7 @@ static void xenfb_disconnect_backend(struct xenfb_info *info)static void xenfb_backend_changed (struct xenbus_device *dev,enum xenbus_state backend_state) { -struct xenfb_info *info = dev->dev.driver_data; +struct xenfb_info *info =dev_get_drvdata (&dev->dev);int val;switch (backend_state) {
Signature · 1 line
1.6.3.2
PATCH 63/64 debugfs: Fix terminology inconsistency of dir name to mount debugfs filesystem.
In reply to Greg KHFrom: GeunSik Lim <[email protected]>
Many developers use "/debug/" or "/debugfs/" or "/sys/kernel/debug/" directory name to mount debugfs filesystem for ftrace according to ./Documentation/tracers/ftrace.txt file.
And, three directory names(ex:/debug/, /debugfs/, /sys/kernel/debug/) is existed in kernel source like ftrace, DRM, Wireless, Documentation, Network[sky2]files to mount debugfs filesystem.
debugfs means debug filesystem for debugging easy to use by greg kroah hartman. "/sys/kernel/debug/" name is suitable as directory name of debugfs filesystem.
- debugfs related reference: http://lwn.net/Articles/334546/
Fix inconsistency of directory name to mount debugfs filesystem.
* From Steven Rostedt
- find_debugfs() and tracing_files() in this patch.
Acked-by : Inaky Perez-Gonzalez <[email protected]> Reviewed-by : Steven Rostedt <[email protected]> Reviewed-by : James Smart <[email protected]>
--- Documentation/DocBook/debugobjects.tmpl | 2 +- Documentation/cdrom/packet-writing.txt | 2 +- Documentation/fault-injection/fault-injection.txt | 70 +++--- Documentation/kprobes.txt | 6 +- Documentation/trace/ftrace.txt | 233 +++++++++++++-------- Documentation/trace/mmiotrace.txt | 26 ++-- drivers/block/pktcdvd.c | 2 +- drivers/gpu/drm/drm_debugfs.c | 12 +- drivers/gpu/drm/drm_drv.c | 2 +- drivers/gpu/drm/drm_stub.c | 2 +- drivers/net/Kconfig | 4 +- drivers/net/wimax/i2400m/i2400m.h | 2 +- drivers/net/wireless/ath/ath5k/Kconfig | 5 +- drivers/net/wireless/libertas/README | 12 +- drivers/scsi/lpfc/lpfc_debugfs.c | 3 +- include/linux/kernel.h | 2 +- include/linux/tracepoint.h | 4 +- kernel/trace/Kconfig | 10 +- kernel/trace/trace.c | 23 +- scripts/tracing/draw_functrace.py | 7 +- 20 files changed, 238 insertions(+), 191 deletions(-)
Documentation/DocBook/debugobjects.tmpl +1 -1
@@ -106,7 +106,7 @@ number of errors are printk'ed including a full stack trace. </para> <para> - The statistics are available via debugfs/debug_objects/stats. + The statistics are available via /sys/kernel/debug/debug_objects/stats. They provide information about the number of warnings and the number of successful fixups along with information about the usage of the internal tracking objects and the state of the
Documentation/cdrom/packet-writing.txt +1 -1
@@ -117,7 +117,7 @@ Using the pktcdvd debugfs interface To read pktcdvd device infos in human readable form, do: - # cat /debug/pktcdvd/pktcdvd[0-7]/info + # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info For a description of the debugfs interface look into the file:
Documentation/fault-injection/fault-injection.txt +35 -35
145 lines not on this page · raw message
Documentation/kprobes.txt +3 -3
@@ -507,9 +507,9 @@ http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf (pages 101-115) Appendix A: The kprobes debugfs interface With recent kernels (> 2.6.20) the list of registered kprobes is visible -under the /debug/kprobes/ directory (assuming debugfs is mounted at /debug). +under the /sys/kernel/debug/kprobes/ directory (assuming debugfs is mounted at //sys/kernel/debug). -/debug/kprobes/list: Lists all registered probes on the system +/sys/kernel/debug/kprobes/list: Lists all registered probes on the system c015d71a k vfs_read+0x0 c011a316 j do_fork+0x0
@@ -525,7 +525,7 @@ virtual addresses that correspond to modules that've been unloaded), such probes are marked with [GONE]. If the probe is temporarily disabled, such probes are marked with [DISABLED]. -/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. +/sys/kernel/debug/kprobes/enabled: Turn kprobes ON/OFF forcibly. Provides a knob to globally and forcibly turn registered kprobes ON or OFF. By default, all kprobes are enabled. By echoing "0" to this file, all
Documentation/trace/ftrace.txt +142 -91
452 lines not on this page · raw message
Documentation/trace/mmiotrace.txt +13 -13
@@ -32,41 +32,41 @@ is no way to automatically detect if you are losing events due to CPUs racing. Usage Quick Reference --------------------- -$ mount -t debugfs debugfs /debug -$ echo mmiotrace > /debug/tracing/current_tracer -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ mount -t debugfs debugfs /sys/kernel/debug +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & Start X or whatever. -$ echo "X is up" > /debug/tracing/trace_marker -$ echo nop > /debug/tracing/current_tracer +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker +$ echo nop > /sys/kernel/debug/tracing/current_tracer Check for lost events. Usage ----- -Make sure debugfs is mounted to /debug. If not, (requires root privileges) -$ mount -t debugfs debugfs /debug +Make sure debugfs is mounted to /sys/kernel/debug. If not, (requires root privileges) +$ mount -t debugfs debugfs /sys/kernel/debug Check that the driver you are about to trace is not loaded. Activate mmiotrace (requires root privileges): -$ echo mmiotrace > /debug/tracing/current_tracer +$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer Start storing the trace: -$ cat /debug/tracing/trace_pipe > mydump.txt & +$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & The 'cat' process should stay running (sleeping) in the background. Load the driver you want to trace and use it. Mmiotrace will only catch MMIO accesses to areas that are ioremapped while mmiotrace is active. During tracing you can place comments (markers) into the trace by -$ echo "X is up" > /debug/tracing/trace_marker +$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker This makes it easier to see which part of the (huge) trace corresponds to which action. It is recommended to place descriptive markers about what you do. Shut down mmiotrace (requires root privileges): -$ echo nop > /debug/tracing/current_tracer +$ echo nop > /sys/kernel/debug/tracing/current_tracer The 'cat' process exits. If it does not, kill it by issuing 'fg' command and pressing ctrl+c.
@@ -78,10 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If events were lost, the trace is incomplete. You should enlarge the buffers and try again. Buffers are enlarged by first seeing how large the current buffers are: -$ cat /debug/tracing/buffer_size_kb +$ cat /sys/kernel/debug/tracing/buffer_size_kb gives you a number. Approximately double this number and write it back, for instance: -$ echo 128000 > /debug/tracing/buffer_size_kb +$ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb Then start again from the top. If you are doing a trace for a driver project, e.g. Nouveau, you should also
drivers/block/pktcdvd.c +1 -1
@@ -430,7 +430,7 @@ static void pkt_sysfs_cleanup(void)/******************************************************************** entries in debugfs -/debugfs/pktcdvd[0-7]/ +/sys/kernel/debug/pktcdvd[0-7]/ info *******************************************************************/
drivers/gpu/drm/drm_debugfs.c +6 -6
@@ -105,7 +105,7 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count, ent =debugfs_create_file (files[i].name,S_IFREG |S_IRUGO , root, tmp, &drm_debugfs_fops);if (!ent) { -DRM_ERROR ("Cannot create /debugfs/dri/%s/%s\n" , +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s/%s\n" , name, files[i].name);drm_free (tmp,sizeof (struct drm_info_node ), _DRM_DRIVER);
@@ -133,9 +133,9 @@ EXPORT_SYMBOL(drm_debugfs_create_files);* \param minor device minor number * \param root DRI debugfs dir entry. * -* Create the DRI debugfs root entry "/debugfs/dri", the device debugfs root entry -* "/debugfs/dri/%minor%/", and each entry in debugfs_list as -* "/debugfs/dri/%minor%/%name%". +* Create the DRI debugfs root entry "/sys/kernel/debug/dri", the device debugfs root entry +* "/sys/kernel/debug/dri/%minor%/", and each entry in debugfs_list as +* "/sys/kernel/debug/dri/%minor%/%name%". */ int drm_debugfs_init (struct drm_minor *minor,int minor_id,struct dentry *root)
@@ -148,7 +148,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,sprintf (name,"%d" , minor_id); minor->debugfs_root =debugfs_create_dir (name, root);if (!minor->debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri/%s\n" , name); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri/%s\n" , name);return -1 ; }
@@ -165,7 +165,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, ret = dev->driver->debugfs_init (minor);if (ret) {DRM_ERROR ("DRM: Driver failed to initialize " -"/debugfs/dri.\n" ); +"/sys/kernel/debug/dri.\n" );return ret; } }
drivers/gpu/drm/drm_drv.c +1 -1
@@ -339,7 +339,7 @@ static int __init drm_core_init(void) drm_debugfs_root =debugfs_create_dir ("dri" ,NULL );if (!drm_debugfs_root) { -DRM_ERROR ("Cannot create /debugfs/dri\n" ); +DRM_ERROR ("Cannot create /sys/kernel/debug/dri\n" ); ret =-1 ; goto err_p3; }
drivers/gpu/drm/drm_stub.c +1 -1
@@ -343,7 +343,7 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t#if defined(CONFIG_DEBUG_FS ) ret =drm_debugfs_init (new_minor, minor_id, drm_debugfs_root);if (ret) { -DRM_ERROR ("DRM: Failed to initialize /debugfs/dri.\n" ); +DRM_ERROR ("DRM: Failed to initialize /sys/kernel/debug/dri.\n" ); goto err_g2; }#endif
drivers/net/Kconfig +2 -2
@@ -2206,7 +2206,7 @@ config SKGE_DEBUG depends on SKGE && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/skge/ethX displays the state of the internal + The file /sys/kernel/debug/skge/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
@@ -2232,7 +2232,7 @@ config SKY2_DEBUG depends on SKY2 && DEBUG_FS help This option adds the ability to dump driver state for debugging. - The file debugfs/sky2/ethX displays the state of the internal + The file /sys/kernel/debug/sky2/ethX displays the state of the internal transmit and receive rings. If unsure, say N.
drivers/net/wimax/i2400m/i2400m.h +1 -1
@@ -432,7 +432,7 @@ struct i2400m { unsigned ready:1; /* all probing steps done */ unsigned rx_reorder:1; /* RX reorder is enabled */u8 trace_msg_from_user;/* echo rx msgs to 'trace' pipe */ -/* typed u8 so debugfs/u8 can tweak */ +/* typed u8 so /sys/kernel/debug/u8 can tweak */ enum i2400m_system_state state;wait_queue_head_t state_wq;/* Woken up when on state updates */
drivers/net/wireless/ath/ath5k/Kconfig +2 -3
@@ -28,11 +28,10 @@ config ATH5K_DEBUG Say Y, if and you will get debug options for ath5k. To use this, you need to mount debugfs: - mkdir /debug/ - mount -t debugfs debug /debug/ + mount -t debugfs debug /sys/kernel/debug You will get access to files under: - /debug/ath5k/phy0/ + /sys/kernel/debug/ath5k/phy0/ To enable debug, pass the debug level to the debug module parameter. For example:
drivers/net/wireless/libertas/README +6 -6
@@ -72,7 +72,7 @@ rdrf location that is to be read. This parameter must be specified in hexadecimal (its possible to preceed preceding the number with a "0x"). - Path: /debugfs/libertas_wireless/ethX/registers/ + Path: /sys/kernel/debug/libertas_wireless/ethX/registers/ Usage: echo "0xa123" > rdmac ; cat rdmac
@@ -95,7 +95,7 @@ wrrf sleepparams This command is used to set the sleepclock configurations - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat sleepparams: reads the current sleepclock configuration
@@ -115,7 +115,7 @@ subscribed_events The subscribed_events directory contains the interface for the subscribed events API. - Path: /debugfs/libertas_wireless/ethX/subscribed_events/ + Path: /sys/kernel/debug/libertas_wireless/ethX/subscribed_events/ Each event is represented by a filename. Each filename consists of the following three fields:
@@ -165,7 +165,7 @@ subscribed_events extscan This command is used to do a specific scan. - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "SSID" > extscan
@@ -179,7 +179,7 @@ getscantable Display the current contents of the driver scan table (ie. get the scan results). - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: cat getscantable
@@ -188,7 +188,7 @@ setuserscan Initiate a customized scan and retrieve the results - Path: /debugfs/libertas_wireless/ethX/ + Path: /sys/kernel/debug/libertas_wireless/ethX/ Usage: echo "[ARGS]" > setuserscan
drivers/scsi/lpfc/lpfc_debugfs.c +1 -2
@@ -53,8 +53,7 @@* debugfs interface * * To access this interface the user should: -* # mkdir /debug -* # mount -t debugfs none /debug +* # mount -t debugfs none /sys/kernel/debug * * The lpfc debugfs directory hierarchy is: * lpfc/lpfcX/vportY
include/linux/kernel.h +1 -1
@@ -406,7 +406,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)* * Use tracing_on/tracing_off when you want to quickly turn on or off * tracing. It simply enables or disables the recording of the trace events. -* This also corresponds to the user space debugfs/tracing/tracing_on +* This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on * file, which gives a means for the kernel and userspace to interact. * Place a tracing_off() in the kernel where you want tracing to end. * From user space, examine the trace, and then echo 1 > tracing_on
include/linux/tracepoint.h +2 -2
@@ -198,7 +198,7 @@ static inline void tracepoint_synchronize_unregister(void)* * This is how the trace record is structured and will * * be saved into the ring buffer. These are the fields * * that will be exposed to user-space in -* * /debug/tracing/events/<*>/format. +* * /sys/kernel/debug/tracing/events/<*>/format. * * * * The declared 'local variable' is called '__entry' * *
@@ -258,7 +258,7 @@ static inline void tracepoint_synchronize_unregister(void)* tracepoint callback (this is used by programmatic plugins and * can also by used by generic instrumentation like SystemTap), and * it is also used to expose a structured trace record in -* /debug/tracing/events/. +* /sys/kernel/debug/tracing/events/. */ #define TRACE_EVENT (name, proto, args, struct, assign, print) \
kernel/trace/Kconfig +5 -5
@@ -147,7 +147,7 @@ config IRQSOFF_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the preempt-off timing option can be
@@ -168,7 +168,7 @@ config PREEMPT_TRACER disabled by default and can be runtime (re-)started via: - echo 0 > /debugfs/tracing/tracing_max_latency + echo 0 > /sys/kernel/debug/tracing/tracing_max_latency (Note that kernel size and overhead increases with this option enabled. This option and the irqs-off timing option can be
@@ -261,7 +261,7 @@ config PROFILE_ANNOTATED_BRANCHES This tracer profiles all the the likely and unlikely macros in the kernel. It will display the results in: - /debugfs/tracing/profile_annotated_branch + /sys/kernel/debug/tracing/profile_annotated_branch Note: this will add a significant overhead, only turn this on if you need to profile the system's use of these macros.
@@ -274,7 +274,7 @@ config PROFILE_ALL_BRANCHES taken in the kernel is recorded whether it hit or miss. The results will be displayed in: - /debugfs/tracing/profile_branch + /sys/kernel/debug/tracing/profile_branch This option also enables the likely/unlikely profiler.
@@ -323,7 +323,7 @@ config STACK_TRACER select KALLSYMS help This special tracer records the maximum stack footprint of the - kernel and displays it in debugfs/tracing/stack_trace. + kernel and displays it in /sys/kernel/debug/tracing/stack_trace. This tracer works by hooking into every function call that the kernel executes, and keeping a maximum stack depth value and
kernel/trace/trace.c +11 -12
@@ -344,7 +344,7 @@ static raw_spinlock_t ftrace_max_lock =/* * Copy the new maximum trace into the separate maximum-trace * structure. (this way the maximum trace is permanently saved, -* for later retrieval via /debugfs/tracing/latency_trace) +* for later retrieval via /sys/kernel/debug/tracing/latency_trace) */ static void __update_max_tr (struct trace_array *tr,struct task_struct *tsk,int cpu)
@@ -2414,21 +2414,20 @@ static const struct file_operations tracing_iter_fops = {static const char readme_msg[] ="tracing mini-HOWTO:\n\n" -"# mkdir /debug\n" -"# mount -t debugfs nodev /debug\n\n" -"# cat /debug/tracing/available_tracers\n" +"# mount -t debugfs nodev /sys/kernel/debug\n\n" +"# cat /sys/kernel/debug/tracing/available_tracers\n" "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n" -"# cat /debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "nop\n" -"# echo sched_switch > /debug/tracing/current_tracer\n" -"# cat /debug/tracing/current_tracer\n" +"# echo sched_switch > /sys/kernel/debug/tracing/current_tracer\n" +"# cat /sys/kernel/debug/tracing/current_tracer\n" "sched_switch\n" -"# cat /debug/tracing/trace_options\n" +"# cat /sys/kernel/debug/tracing/trace_options\n" "noprint-parent nosym-offset nosym-addr noverbose\n" -"# echo print-parent > /debug/tracing/trace_options\n" -"# echo 1 > /debug/tracing/tracing_enabled\n" -"# cat /debug/tracing/trace > /tmp/trace.txt\n" -"# echo 0 > /debug/tracing/tracing_enabled\n" +"# echo print-parent > /sys/kernel/debug/tracing/trace_options\n" +"# echo 1 > /sys/kernel/debug/tracing/tracing_enabled\n" +"# cat /sys/kernel/debug/tracing/trace > /tmp/trace.txt\n" +"# echo 0 > /sys/kernel/debug/tracing/tracing_enabled\n" ; static ssize_t
scripts/tracing/draw_functrace.py +3 -4
@@ -12,10 +12,9 @@ calls. Only the functions's names and the the call time are provided. Usage: Be sure that you have CONFIG_FUNCTION_TRACER - # mkdir /debugfs - # mount -t debug debug /debug - # echo function > /debug/tracing/current_tracer - $ cat /debug/tracing/trace_pipe > ~/raw_trace_func + # mount -t debugfs nodev /sys/kernel/debug + # echo function > /sys/kernel/debug/tracing/current_tracer + $ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func Wait some times but not too much, the script is a bit slow. Break the pipe (Ctrl + Z) $ scripts/draw_functrace.py < raw_trace_func > draw_functrace
Signature · 1 line
1.6.3.2
PATCH 64/64 debugfs: use specified mode to possibly mark files read/write only
In reply to Greg KHFrom: Robin Getz <[email protected]>
In many SoC implementations there are hardware registers can be read or write only. This extends the debugfs to enforce the file permissions for these types of registers by providing a set of fops which are read or write only. This assumes that the kernel developer knows more about the hardware than the user (even root users) -- which is normally true.
--- fs/debugfs/file.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-)
fs/debugfs/file.c +63 -0
@@ -67,6 +67,8 @@ static int debugfs_u8_get(void *data, u64 *val)return 0 ; }DEFINE_SIMPLE_ATTRIBUTE (fops_u8, debugfs_u8_get, debugfs_u8_set,"%llu\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_u8_ro, debugfs_u8_get,NULL ,"%llu\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_u8_wo,NULL , debugfs_u8_set,"%llu\n" );/** * debugfs_create_u8 - create a debugfs file that is used to read and write an unsigned 8-bit value
@@ -95,6 +97,13 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n");struct dentry *debugfs_create_u8 (const char *name,mode_t mode,struct dentry *parent,u8 *value) { +/* if there are no write bits set, make read only */ +if (!(mode &S_IWUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_u8_ro); +/* if there are no read bits set, make write only */ +if (!(mode &S_IRUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_u8_wo); +return debugfs_create_file (name, mode, parent, value, &fops_u8); }EXPORT_SYMBOL_GPL (debugfs_create_u8);
@@ -110,6 +119,8 @@ static int debugfs_u16_get(void *data, u64 *val)return 0 ; }DEFINE_SIMPLE_ATTRIBUTE (fops_u16, debugfs_u16_get, debugfs_u16_set,"%llu\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_u16_ro, debugfs_u16_get,NULL ,"%llu\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_u16_wo,NULL , debugfs_u16_set,"%llu\n" );/** * debugfs_create_u16 - create a debugfs file that is used to read and write an unsigned 16-bit value
@@ -138,6 +149,13 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n");struct dentry *debugfs_create_u16 (const char *name,mode_t mode,struct dentry *parent,u16 *value) { +/* if there are no write bits set, make read only */ +if (!(mode &S_IWUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_u16_ro); +/* if there are no read bits set, make write only */ +if (!(mode &S_IRUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_u16_wo); +return debugfs_create_file (name, mode, parent, value, &fops_u16); }EXPORT_SYMBOL_GPL (debugfs_create_u16);
@@ -153,6 +171,8 @@ static int debugfs_u32_get(void *data, u64 *val)return 0 ; }DEFINE_SIMPLE_ATTRIBUTE (fops_u32, debugfs_u32_get, debugfs_u32_set,"%llu\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_u32_ro, debugfs_u32_get,NULL ,"%llu\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_u32_wo,NULL , debugfs_u32_set,"%llu\n" );/** * debugfs_create_u32 - create a debugfs file that is used to read and write an unsigned 32-bit value
@@ -181,6 +201,13 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n");struct dentry *debugfs_create_u32 (const char *name,mode_t mode,struct dentry *parent,u32 *value) { +/* if there are no write bits set, make read only */ +if (!(mode &S_IWUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_u32_ro); +/* if there are no read bits set, make write only */ +if (!(mode &S_IRUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_u32_wo); +return debugfs_create_file (name, mode, parent, value, &fops_u32); }EXPORT_SYMBOL_GPL (debugfs_create_u32);
@@ -197,6 +224,8 @@ static int debugfs_u64_get(void *data, u64 *val)return 0 ; }DEFINE_SIMPLE_ATTRIBUTE (fops_u64, debugfs_u64_get, debugfs_u64_set,"%llu\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_u64_ro, debugfs_u64_get,NULL ,"%llu\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_u64_wo,NULL , debugfs_u64_set,"%llu\n" );/** * debugfs_create_u64 - create a debugfs file that is used to read and write an unsigned 64-bit value
@@ -225,15 +254,28 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u64, debugfs_u64_get, debugfs_u64_set, "%llu\n");struct dentry *debugfs_create_u64 (const char *name,mode_t mode,struct dentry *parent,u64 *value) { +/* if there are no write bits set, make read only */ +if (!(mode &S_IWUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_u64_ro); +/* if there are no read bits set, make write only */ +if (!(mode &S_IRUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_u64_wo); +return debugfs_create_file (name, mode, parent, value, &fops_u64); }EXPORT_SYMBOL_GPL (debugfs_create_u64);DEFINE_SIMPLE_ATTRIBUTE (fops_x8, debugfs_u8_get, debugfs_u8_set,"0x%02llx\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_x8_ro, debugfs_u8_get,NULL ,"0x%02llx\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_x8_wo,NULL , debugfs_u8_set,"0x%02llx\n" );DEFINE_SIMPLE_ATTRIBUTE (fops_x16, debugfs_u16_get, debugfs_u16_set,"0x%04llx\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_x16_ro, debugfs_u16_get,NULL ,"0x%04llx\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_x16_wo,NULL , debugfs_u16_set,"0x%04llx\n" );DEFINE_SIMPLE_ATTRIBUTE (fops_x32, debugfs_u32_get, debugfs_u32_set,"0x%08llx\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_x32_ro, debugfs_u32_get,NULL ,"0x%08llx\n" ); +DEFINE_SIMPLE_ATTRIBUTE (fops_x32_wo,NULL , debugfs_u32_set,"0x%08llx\n" );/* * debugfs_create_x{8,16,32} - create a debugfs file that is used to read and write an unsigned {8,16,32}-bit value
@@ -256,6 +298,13 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_x32, debugfs_u32_get, debugfs_u32_set, "0x%08llx\n"struct dentry *debugfs_create_x8 (const char *name,mode_t mode,struct dentry *parent,u8 *value) { +/* if there are no write bits set, make read only */ +if (!(mode &S_IWUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_x8_ro); +/* if there are no read bits set, make write only */ +if (!(mode &S_IRUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_x8_wo); +return debugfs_create_file (name, mode, parent, value, &fops_x8); }EXPORT_SYMBOL_GPL (debugfs_create_x8);
@@ -273,6 +322,13 @@ EXPORT_SYMBOL_GPL(debugfs_create_x8);struct dentry *debugfs_create_x16 (const char *name,mode_t mode,struct dentry *parent,u16 *value) { +/* if there are no write bits set, make read only */ +if (!(mode &S_IWUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_x16_ro); +/* if there are no read bits set, make write only */ +if (!(mode &S_IRUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_x16_wo); +return debugfs_create_file (name, mode, parent, value, &fops_x16); }EXPORT_SYMBOL_GPL (debugfs_create_x16);
@@ -290,6 +346,13 @@ EXPORT_SYMBOL_GPL(debugfs_create_x16);struct dentry *debugfs_create_x32 (const char *name,mode_t mode,struct dentry *parent,u32 *value) { +/* if there are no write bits set, make read only */ +if (!(mode &S_IWUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_x32_ro); +/* if there are no read bits set, make write only */ +if (!(mode &S_IRUGO )) +return debugfs_create_file (name, mode, parent, value, &fops_x32_wo); +return debugfs_create_file (name, mode, parent, value, &fops_x32); }EXPORT_SYMBOL_GPL (debugfs_create_x32);
Signature · 1 line
1.6.3.2