recursive printk, make functions from logging macros
Subsystems (15)
v2 cover recursive printk, make functions from logging macros
dev_<level> macros use a lot of repetitive string space and arguments pr_<level> macros use repetitive unnecessary KERN_<level> strings
Eliminate the string prefixes and function arguments from all the macro uses and consolidate them in functions.
This patchset saves about 60K of text in an x86 defconfig.
This implementation adds the ability to use a struct va_format to emit a format string along with va_list arguments.
This %pV implementation should not be used without a wrapper that does printf argument verification like the dev_<level> functions.
Inspired a bit by Nick Andrew's patches and Linus' comments in December 2008
http://lkml.org/lkml/2008/12/6/15
http://lkml.org/lkml/2008/12/6/101
Joe Perches (3):
vsprintf: Recursive vsnprintf: Add "%pV", struct va_format device.h drivers/base/core.c Convert dev_<level> macros to functions kernel.h kernel/printk.c: Convert pr_<level> macros to functions
drivers/base/core.c | 56 +++++++++++++++++++++++++ include/linux/device.h | 105 ++++++++++++++++++++++++++++++++++++------------ include/linux/kernel.h | 75 +++++++++++++++++++++++++++------- kernel/printk.c | 26 ++++++++++++ lib/vsprintf.c | 9 ++++ 5 files changed, 229 insertions(+), 42 deletions(-)
PATCH v2 1/3 vsprintf: Recursive vsnprintf: Add "%pV", struct va_format
Add the ability to print a format and va_list from a structure pointer
Allows __dev_printk to be implemented as a single printk while minimizing string space duplication.
%pV should not be used without some mechanism to verify the format and argument use ala __attribute__(format (printf(...))).
--- include/linux/kernel.h | 5 +++++ lib/vsprintf.c | 9 +++++++++ 2 files changed, 14 insertions(+), 0 deletions(-)
include/linux/kernel.h +5 -0
@@ -169,6 +169,11 @@ static inline void might_fault(void) }#endif +struct va_format { +const char *fmt; +va_list *va; +}; +extern struct atomic_notifier_head panic_notifier_list;extern long (*panic_blink)(long time); NORET_TYPE void panic(const char * fmt, ...)
lib/vsprintf.c +9 -0
@@ -950,6 +950,11 @@ static char *uuid_string(char *buf, char *end, const u8 *addr,* [0][1][2][3]-[4][5]-[6][7]-[8][9]-[10][11][12][13][14][15] * little endian output byte order is: * [3][2][1][0]-[5][4]-[7][6]-[8][9]-[10][11][12][13][14][15] +* - 'V' For a struct va_format which contains a format string * and va_list *, +* call vsnprintf(->format, *->va_list). +* Implements a "recursive vsnprintf". +* Do not use this feature without some mechanism to verify the +* correctness of the format string and va_list arguments. * * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 * function pointers are really function descriptors, which contain a
@@ -994,6 +999,10 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,break ;case 'U' :return uuid_string (buf, end, ptr, spec, fmt); +case 'V' : +return buf +vsnprintf (buf, end - buf, + ((struct va_format *)ptr)->fmt, + *(((struct va_format *)ptr)->va)); } spec.flags |=SMALL ;if (spec.field_width ==-1 ) {
Signature · 1 line
1.7.0.14.g7e948
PATCH v2 2/3 device.h drivers/base/core.c Convert dev_<level> macros to functions
In reply to Joe PerchesSave ~60k in a defconfig
Use %pV and struct va_format
Format arguments are verified before printk
There are existing "struct dev_info" declarations as well as local variables named dev_info so the dev_info macro to function conversion is instead called _dev_info and a macro is used to call _dev_info
Perhaps over time the struct and local uses of dev_info should be renamed.
--- drivers/base/core.c | 56 +++++++++++++++++++++++++ include/linux/device.h | 105 ++++++++++++++++++++++++++++++++++++------------ 2 files changed, 135 insertions(+), 26 deletions(-)
drivers/base/core.c +56 -0
@@ -1745,3 +1745,59 @@ void device_shutdown(void) }async_synchronize_full (); } + +/* +* Device logging functions +*/ + +#ifdef CONFIG_PRINTK + +static int __dev_printk (const char *level,const struct device *dev, +const char *fmt,va_list args) +{ +struct va_format vaf; + + vaf.fmt = fmt; + vaf.va = &args; +return printk ("%s%s %s: %pV" , + level,dev_driver_string (dev),dev_name (dev), &vaf); +} + +int dev_printk (const char *level,const struct device *dev, +const char *fmt, ...) +{ +int r; +va_list args; + +va_start (args, fmt); + r =__dev_printk (level, dev, fmt, args); +va_end (args); + +return r; +} +EXPORT_SYMBOL (dev_printk); + +#define declare_dev_level (function, level) \ +int function(const struct device *dev, const char *fmt, ...) \ +{ \ + int r; \ + va_list args; \ + \ + va_start(args, fmt); \ + r = __dev_printk(level, dev, fmt, args); \ + va_end(args); \ + \ + return r; \ +} \ +EXPORT_SYMBOL(function) + +declare_dev_level (dev_emerg,KERN_EMERG ); +declare_dev_level (dev_alert,KERN_ALERT ); +declare_dev_level (dev_crit,KERN_CRIT ); +declare_dev_level (dev_err,KERN_ERR ); +declare_dev_level (dev_warn,KERN_WARNING ); +declare_dev_level (dev_notice,KERN_NOTICE ); +declare_dev_level (_dev_info,KERN_INFO ); +/* Not dev_info because it conflicts with with existing "struct dev_info" */ + +#endif
include/linux/device.h +79 -26
122 lines not on this page · raw message
Signature · 1 line
1.7.0.14.g7e948
Andrew Morton
maintainerRe: [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions
Quoted 1 line · On Thu, 4 Mar 2010 22:56:53 -0800 Joe Perches <[email protected]> wrote:
Perhaps over time the struct and local uses of
dev_infoshould be renamed.
aww, c'mon.
y:/usr/src/linux-2.6.33> grep -r '\*dev_info;' . | wc -l 30
Half an hour, tops.
Re: [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions
Quoted 5 lines · Andrew Morton
Quoted 1 line · On Thu, 4 Mar 2010 22:56:53 -0800 Joe Perches <[email protected]> wrote:
Perhaps over time the struct and local uses of
dev_infoshould be renamed.aww, c'mon.
y:/usr/src/linux-2.6.33> grep -r '\*dev_info;' . | wc -l 30
No doubt I could submit all the required changes in an hour or so, but some of the maintainers seem less than open to what they consider "churn".
$ grep -rP --include=*.[ch] -l "dev_info\b\s*[^\(]" * arch/powerpc/platforms/iseries/dt.c drivers/usb/host/xhci-dbg.c drivers/usb/host/xhci.h drivers/usb/wusbcore/wusbhc.h drivers/scsi/scsi_devinfo.c drivers/staging/comedi/drivers/das08_cs.c drivers/staging/comedi/drivers/ni_daq_dio24.c drivers/staging/comedi/drivers/quatech_daqp_cs.c drivers/staging/comedi/drivers/ni_daq_700.c drivers/staging/comedi/drivers/ni_labpc_cs.c drivers/staging/comedi/drivers/cb_das16_cs.c drivers/staging/udlfb/udlfb.c drivers/media/video/sh_mobile_ceu_camera.c drivers/md/linear.h drivers/net/ksz884x.c drivers/net/bnx2x_link.c drivers/net/wireless/wl3501_cs.c drivers/net/cnic.c drivers/net/bnx2x_main.c include/linux/sfi.h include/net/bluetooth/rfcomm.h
Andrew Morton
maintainerRe: [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions
Quoted 10 lines · On Thu, 04 Mar 2010 23:23:35 -0800 Joe Perches <[email protected]> wrote:
Quoted 5 lines · Andrew Morton
Quoted 1 line · On Thu, 4 Mar 2010 22:56:53 -0800 Joe Perches <[email protected]> wrote:
Perhaps over time the struct and local uses of
dev_infoshould be renamed.aww, c'mon.
y:/usr/src/linux-2.6.33> grep -r '\*dev_info;' . | wc -l 30No doubt I could submit all the required changes in an hour or so, but some of the maintainers seem less than open to what they consider "churn".
Well, that has to be one of the worst possible reasons?
Quoted 14 lines
$ grep -rP --include=*.[ch] -l "dev_info\b\s*[^\(]" * arch/powerpc/platforms/iseries/dt.c drivers/usb/host/xhci-dbg.c drivers/usb/host/xhci.h drivers/usb/wusbcore/wusbhc.h drivers/scsi/scsi_devinfo.c drivers/staging/comedi/drivers/das08_cs.c drivers/staging/comedi/drivers/ni_daq_dio24.c drivers/staging/comedi/drivers/quatech_daqp_cs.c drivers/staging/comedi/drivers/ni_daq_700.c drivers/staging/comedi/drivers/ni_labpc_cs.c drivers/staging/comedi/drivers/cb_das16_cs.c drivers/staging/udlfb/udlfb.c drivers/media/video/sh_mobile_ceu_camera.c
Quoted 8 lines
drivers/md/linear.h drivers/net/ksz884x.c drivers/net/bnx2x_link.c drivers/net/wireless/wl3501_cs.c drivers/net/cnic.c drivers/net/bnx2x_main.c include/linux/sfi.h include/net/bluetooth/rfcomm.h
Send 'em over, please. I'll merge any stragglers directly.
cover treewide: rename dev_info variables to something else
There is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
Joe Perches (11):
arch/ia64/hp/common/sba_iommu.c: Rename dev_info to adi drivers/usb/host/hwa-hc.c: Rename dev_info to hdi drivers/usb/wusbcore/wusbhc.h: Remove unused dev_info from struct wusb_port drivers/s390/block/dcssblk.c: Rename dev_info to ddi drivers/edac/amd: Rename dev_info to adi drivers/edac/cpc925_edac.c: Rename dev_info to cdi drivers/edac/e7*_edac.c: Rename dev_info to edi drivers/staging/iio: Rename dev_info to idi
pvrusb2-v4l2: Rename dev_info to pdi
drivers/char/mem.c: Rename dev_info to bdi
drivers/uwb: Rename dev_info to wdi
arch/ia64/hp/common/sba_iommu.c | 8 +- drivers/char/mem.c | 6 +- drivers/edac/amd8111_edac.c | 88 ++++---- drivers/edac/amd8131_edac.c | 86 ++++---- drivers/edac/cpc925_edac.c | 122 +++++----- drivers/edac/e752x_edac.c | 18 +- drivers/edac/e7xxx_edac.c | 8 +- drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 22 +- drivers/s390/block/dcssblk.c | 328 ++++++++++++++-------------- drivers/staging/iio/accel/lis3l02dq_core.c | 4 +- drivers/staging/iio/accel/lis3l02dq_ring.c | 20 +- drivers/staging/iio/accel/sca3000_core.c | 24 +- drivers/staging/iio/adc/max1363_core.c | 36 ++-- drivers/staging/iio/adc/max1363_ring.c | 6 +- drivers/staging/iio/chrdev.h | 2 +- drivers/staging/iio/iio.h | 54 +++--- drivers/staging/iio/industrialio-core.c | 232 ++++++++++---------- drivers/staging/iio/industrialio-ring.c | 38 ++-- drivers/staging/iio/industrialio-trigger.c | 34 ++-- drivers/staging/iio/ring_generic.h | 4 +- drivers/staging/iio/trigger_consumer.h | 16 +- drivers/usb/host/hwa-hc.c | 18 +- drivers/usb/wusbcore/wusbhc.h | 10 - drivers/uwb/i1480/i1480u-wlp/lc.c | 16 +- drivers/uwb/wlp/messages.c | 40 ++-- drivers/uwb/wlp/sysfs.c | 46 ++-- drivers/uwb/wlp/wlp-lc.c | 12 +- 27 files changed, 644 insertions(+), 654 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/11 arch/ia64/hp/common/sba_iommu.c: Rename dev_info to adi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- arch/ia64/hp/common/sba_iommu.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
arch/ia64/hp/common/sba_iommu.c +4 -4
@@ -2046,13 +2046,13 @@ acpi_sba_ioc_add(struct acpi_device *device)struct ioc *ioc;acpi_status status;u64 hpa, length; -struct acpi_device_info *dev_info; +struct acpi_device_info *adi; status =hp_acpi_csr_space (device->handle, &hpa, &length);if (ACPI_FAILURE (status))return 1 ; - status =acpi_get_object_info (device->handle, &dev_info); + status =acpi_get_object_info (device->handle, &adi);if (ACPI_FAILURE (status))return 1 ;
@@ -2060,13 +2060,13 @@ acpi_sba_ioc_add(struct acpi_device *device)* For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI * root bridges, and its CSR space includes the IOC function. */ -if (strncmp ("HWP0001" , dev_info->hardware_id.string,7 ) =0 ) { +if (strncmp ("HWP0001" , adi->hardware_id.string,7 ) =0 ) { hpa +=ZX1_IOC_OFFSET ;/* zx1 based systems default to kernel page size iommu pages */ if (!iovp_shift) iovp_shift =min (PAGE_SHIFT ,16 ); } -kfree (dev_info); +kfree (adi);/* * default anything not caught above or specified on cmdline to 4k
Signature · 1 line
1.7.0.3.311.g6a6955
PATCH 2/11 drivers/usb/host/hwa-hc.c: Rename dev_info to hdi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/usb/host/hwa-hc.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/usb/host/hwa-hc.c +9 -9
@@ -375,16 +375,16 @@ static int __hwahc_op_dev_info_set(struct wusbhc *wusbhc, struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc);struct wahc *wa = &hwahc->wa;u8 iface_no = wa->usb_iface->cur_altsetting->desc.bInterfaceNumber; -struct hwa_dev_info *dev_info; +struct hwa_dev_info *hdi;int ret;/* fill out the Device Info buffer and send it */ - dev_info =kzalloc (sizeof (struct hwa_dev_info ),GFP_KERNEL ); -if (!dev_info) + hdi =kzalloc (sizeof (struct hwa_dev_info ),GFP_KERNEL ); +if (!hdi)return -ENOMEM ; -uwb_mas_bm_copy_le (dev_info->bmDeviceAvailability, +uwb_mas_bm_copy_le (hdi->bmDeviceAvailability, &wusb_dev->availability); - dev_info->bDeviceAddress = wusb_dev->addr; + hdi->bDeviceAddress = wusb_dev->addr;/* * If the descriptors haven't been read yet, use a default PHY
@@ -394,17 +394,17 @@ static int __hwahc_op_dev_info_set(struct wusbhc *wusbhc,* have been read). */ if (wusb_dev->wusb_cap_descr) - dev_info->wPHYRates = wusb_dev->wusb_cap_descr->wPHYRates; + hdi->wPHYRates = wusb_dev->wusb_cap_descr->wPHYRates;else - dev_info->wPHYRates =cpu_to_le16 (USB_WIRELESS_PHY_53 ); + hdi->wPHYRates =cpu_to_le16 (USB_WIRELESS_PHY_53 ); ret =usb_control_msg (wa->usb_dev,usb_sndctrlpipe (wa->usb_dev,0 ),WUSB_REQ_SET_DEV_INFO ,USB_DIR_OUT |USB_TYPE_CLASS |USB_RECIP_INTERFACE ,0 , wusb_dev->port_idx <<8 | iface_no, - dev_info,sizeof (struct hwa_dev_info ), + hdi,sizeof (struct hwa_dev_info ),1000 /* FIXME: arbitrary */ ); -kfree (dev_info); +kfree (hdi);return ret; }
Signature · 1 line
1.7.0.3.311.g6a6955
Re: [PATCH 02/11] drivers/usb/host/hwa-hc.c: Rename dev_info to hdi
Quoted 8 lines · Joe Perches
There is a macro called
dev_infothat prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.Rename the existing
dev_infovariables to something else in preparation to converting thedev_infomacro to a function.Signed-off-by Joe Perches <[email protected]>
David
Signature · 6 lines
David Vrabel, Senior Software Engineer, Drivers CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562 Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/ Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
PATCH 3/11 drivers/usb/wusbcore/wusbhc.h: Remove unused dev_info from struct wusb_port
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/usb/wusbcore/wusbhc.h | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
drivers/usb/wusbcore/wusbhc.h +0 -10
@@ -185,15 +185,6 @@ struct wusb_port {* * Read/Write protected by @mutex * -* @dev_info This array has ports_max elements. It is used to -* give the HC information about the WUSB devices (see -* 'struct wusb_dev_info'). -* -* For HWA we need to allocate it in heap; for WHCI it -* needs to be permanently mapped, so we keep it for -* both and make it easy. Call wusbhc->dev_info_set() -* to update an entry. -* * @ports_max Number of simultaneous device connections (fake * ports) this HC will take. Read-only. *
@@ -259,7 +250,6 @@ struct wusbhc {struct mutex mutex;/* locks everything else */ u16 cluster_id;/* Wireless USB Cluster ID */ struct wusb_port *port;/* Fake port status handling */ -struct wusb_dev_info *dev_info;/* for Set Device Info mgmt */ u8 ports_max; unsigned active:1; /* currently xmit'ing MMCs */struct wuie_keep_alive keep_alive_ie;/* protected by mutex */
Signature · 1 line
1.7.0.3.311.g6a6955
Re: [PATCH 03/11] drivers/usb/wusbcore/wusbhc.h: Remove unused dev_info from struct wusb_port
Hello.
Quoted 7 lines · Joe Perches
There is a macro called
dev_infothat prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.Rename the existing
dev_infovariables to something else in preparation to converting thedev_infomacro to a function.
You're not renaming the variable in this case, you're removing a field.
Quoted 27 lines
Signed-off-by Joe Perches <[email protected]>--- drivers/usb/wusbcore/wusbhc.h | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)drivers/usb/wusbcore/wusbhc.h +0
-9@@ -185,15 +185,6 @@ struct wusb_port {* * Read/Write protected by @mutex * -* @dev_info This array has ports_max elements. It is used to -* give the HC information about the WUSB devices (see -* 'struct wusb_dev_info'). -* -* For HWA we need to allocate it in heap; for WHCI it -* needs to be permanently mapped, so we keep it for -* both and make it easy. Call wusbhc->dev_info_set() -* to update an entry. -* * @ports_max Number of simultaneous device connections (fake * ports) this HC will take. Read-only. *
drivers/usb/wusbcore/wusbhc.h struct wusbhc { · line 255
Quoted 7 lines
drivers/usb/wusbcore/wusbhc.h +0
-1@@ -259,7 +250,6 @@ struct wusbhc {struct mutex mutex;/* locks everything else */ u16 cluster_id;/* Wireless USB Cluster ID */ struct wusb_port *port;/* Fake port status handling */ -struct wusb_dev_info *dev_info;/* for Set Device Info mgmt */ u8 ports_max; unsigned active:1; /* currently xmit'ing MMCs */struct wuie_keep_alive keep_alive_ie;/* protected by mutex */
WBR, Sergei
Re: [PATCH 03/11] drivers/usb/wusbcore/wusbhc.h: Remove unused dev_info from struct wusb_port
In reply to Joe PerchesQuoted 8 lines · Joe Perches
There is a macro called
dev_infothat prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.Rename the existing
dev_infovariables to something else in preparation to converting thedev_infomacro to a function.Signed-off-by Joe Perches <[email protected]>
This commit message isn't strictly correct but otherwise,
Not sure what this field was ever for...
David
Signature · 6 lines
David Vrabel, Senior Software Engineer, Drivers CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562 Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/ Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
PATCH 4/11 drivers/s390/block/dcssblk.c: Rename dev_info to ddi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/s390/block/dcssblk.c | 328 +++++++++++++++++++++--------------------- 1 files changed, 164 insertions(+), 164 deletions(-)
drivers/s390/block/dcssblk.c +164 -164
@@ -98,15 +98,15 @@ static struct rw_semaphore dcssblk_devices_sem;static void dcssblk_release_segment (struct device *dev) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct segment_info *entry, *temp; - dev_info = container_of(dev, struct dcssblk_dev_info, dev); -list_for_each_entry_safe (entry, temp, &dev_info->seg_list, lh) { + ddi = container_of(dev, struct dcssblk_dev_info, dev); +list_for_each_entry_safe (entry, temp, &ddi->seg_list, lh) {list_del (&entry->lh);kfree (entry); } -kfree (dev_info); +kfree (ddi);module_put (THIS_MODULE ); }
@@ -117,12 +117,12 @@ dcssblk_release_segment(struct device *dev)* freed. */ static int -dcssblk_assign_free_minor (struct dcssblk_dev_info *dev_info) +dcssblk_assign_free_minor (struct dcssblk_dev_info *ddi) {int minor, found;struct dcssblk_dev_info *entry; -if (dev_info ==NULL ) +if (ddi ==NULL )return -EINVAL ;for (minor =0 ; minor < (1 <<MINORBITS ); minor++) { found =0 ;
@@ -134,7 +134,7 @@ dcssblk_assign_free_minor(struct dcssblk_dev_info *dev_info) }if (found)return -EBUSY ; - dev_info->gd->first_minor = minor; + ddi->gd->first_minor = minor;return 0 ; }
@@ -164,11 +164,11 @@ dcssblk_get_device_by_name(char *name)static struct segment_info *dcssblk_get_segment_by_name (char *name) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct segment_info *entry; -list_for_each_entry (dev_info, &dcssblk_devices, lh) { -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (ddi, &dcssblk_devices, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) {if (!strcmp (name, entry->segment_name))return entry; }
@@ -180,13 +180,13 @@ dcssblk_get_segment_by_name(char *name)* get the highest address of the multi-segment block. */ static unsigned long -dcssblk_find_highest_addr (struct dcssblk_dev_info *dev_info) +dcssblk_find_highest_addr (struct dcssblk_dev_info *ddi) {unsigned long highest_addr;struct segment_info *entry; highest_addr =0 ; -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) {if (highest_addr < entry->end) highest_addr = entry->end; }
@@ -197,7 +197,7 @@ dcssblk_find_highest_addr(struct dcssblk_dev_info *dev_info)* get the lowest address of the multi-segment block. */ static unsigned long -dcssblk_find_lowest_addr (struct dcssblk_dev_info *dev_info) +dcssblk_find_lowest_addr (struct dcssblk_dev_info *ddi) {int set_first;unsigned long lowest_addr;
@@ -205,7 +205,7 @@ dcssblk_find_lowest_addr(struct dcssblk_dev_info *dev_info) set_first =0 ; lowest_addr =0 ; -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) {if (set_first ==0 ) { lowest_addr = entry->start; set_first =1 ;
@@ -221,28 +221,28 @@ dcssblk_find_lowest_addr(struct dcssblk_dev_info *dev_info)* Check continuity of segments. */ static int -dcssblk_is_continuous (struct dcssblk_dev_info *dev_info) +dcssblk_is_continuous (struct dcssblk_dev_info *ddi) {int i, j, rc;struct segment_info *sort_list, *entry, temp; -if (dev_info->num_of_segments <=1 ) +if (ddi->num_of_segments <=1 )return 0 ; sort_list =kzalloc ( -sizeof (struct segment_info ) * dev_info->num_of_segments, +sizeof (struct segment_info ) * ddi->num_of_segments,GFP_KERNEL );if (sort_list ==NULL )return -ENOMEM ; i =0 ; -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) {memcpy (&sort_list[i], entry,sizeof (struct segment_info )); i++; }/* sort segments */ -for (i =0 ; i < dev_info->num_of_segments; i++) -for (j =0 ; j < dev_info->num_of_segments; j++) +for (i =0 ; i < ddi->num_of_segments; i++) +for (j =0 ; j < ddi->num_of_segments; j++)if (sort_list[j].start > sort_list[i].start) {memcpy (&temp, &sort_list[i],sizeof (struct segment_info ));
@@ -253,7 +253,7 @@ dcssblk_is_continuous(struct dcssblk_dev_info *dev_info) }/* check continuity */ -for (i =0 ; i < dev_info->num_of_segments -1 ; i++) { +for (i =0 ; i < ddi->num_of_segments -1 ; i++) {if ((sort_list[i].end +1 ) != sort_list[i+1 ].start) { pr_err("Adjacent DCSSs %s and %s are not " "contiguous\n", sort_list[i].segment_name,
@@ -331,30 +331,30 @@ static void dcssblk_unregister_callback(struct device *dev)static ssize_t dcssblk_shared_show (struct device *dev,struct device_attribute *attr,char *buf) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi; - dev_info = container_of(dev, struct dcssblk_dev_info, dev); -return sprintf (buf, dev_info->is_shared ?"1\n" :"0\n" ); + ddi = container_of(dev, struct dcssblk_dev_info, dev); +return sprintf (buf, ddi->is_shared ?"1\n" :"0\n" ); }static ssize_t dcssblk_shared_store (struct device *dev,struct device_attribute *attr,const char *inbuf,size_t count) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct segment_info *entry, *temp;int rc;if ((count >1 ) && (inbuf[1 ] !='\n' ) && (inbuf[1 ] !='\0' ))return -EINVAL ;down_write (&dcssblk_devices_sem); - dev_info = container_of(dev, struct dcssblk_dev_info, dev); -if (atomic_read (&dev_info->use_count)) { + ddi = container_of(dev, struct dcssblk_dev_info, dev); +if (atomic_read (&ddi->use_count)) { rc = -EBUSY ; goto out; }if (inbuf[0 ] =='1' ) {/* reload segments in shared mode */ -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) { rc =segment_modify_shared (entry->segment_name,SEGMENT_SHARED );if (rc <0 ) {
@@ -363,23 +363,23 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch goto removeseg; } } - dev_info->is_shared =1 ; -switch (dev_info->segment_type) { + ddi->is_shared =1 ; +switch (ddi->segment_type) {case SEG_TYPE_SR :case SEG_TYPE_ER :case SEG_TYPE_SC : -set_disk_ro (dev_info->gd,1 ); +set_disk_ro (ddi->gd,1 ); } }else if (inbuf[0 ] =='0' ) {/* reload segments in exclusive mode */ -if (dev_info->segment_type ==SEG_TYPE_SC ) { +if (ddi->segment_type ==SEG_TYPE_SC ) {pr_err ("DCSS %s is of type SC and cannot be " "loaded as exclusive-writable\n" , - dev_info->segment_name); + ddi->segment_name); rc = -EINVAL ; goto out; } -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) { rc =segment_modify_shared (entry->segment_name,SEGMENT_EXCLUSIVE );if (rc <0 ) {
@@ -388,8 +388,8 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch goto removeseg; } } - dev_info->is_shared =0 ; -set_disk_ro (dev_info->gd,0 ); + ddi->is_shared =0 ; +set_disk_ro (ddi->gd,0 ); }else { rc = -EINVAL ; goto out;
@@ -399,18 +399,18 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch removeseg:pr_err ("DCSS device %s is removed after a failed access mode " -"change\n" , dev_info->segment_name); +"change\n" , ddi->segment_name); temp = entry; -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) {if (entry != temp)segment_unload (entry->segment_name); } -list_del (&dev_info->lh); +list_del (&ddi->lh); -del_gendisk (dev_info->gd); -blk_cleanup_queue (dev_info->dcssblk_queue); - dev_info->gd->queue =NULL ; -put_disk (dev_info->gd); +del_gendisk (ddi->gd); +blk_cleanup_queue (ddi->dcssblk_queue); + ddi->gd->queue =NULL ; +put_disk (ddi->gd); rc =device_schedule_callback (dev, dcssblk_unregister_callback); out:up_write (&dcssblk_devices_sem);
@@ -427,29 +427,29 @@ out:static ssize_t dcssblk_save_show (struct device *dev,struct device_attribute *attr,char *buf) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi; - dev_info = container_of(dev, struct dcssblk_dev_info, dev); -return sprintf (buf, dev_info->save_pending ?"1\n" :"0\n" ); + ddi = container_of(dev, struct dcssblk_dev_info, dev); +return sprintf (buf, ddi->save_pending ?"1\n" :"0\n" ); }static ssize_t dcssblk_save_store (struct device *dev,struct device_attribute *attr,const char *inbuf,size_t count) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct segment_info *entry;if ((count >1 ) && (inbuf[1 ] !='\n' ) && (inbuf[1 ] !='\0' ))return -EINVAL ; - dev_info = container_of(dev, struct dcssblk_dev_info, dev); + ddi = container_of(dev, struct dcssblk_dev_info, dev);down_write (&dcssblk_devices_sem);if (inbuf[0 ] =='1' ) { -if (atomic_read (&dev_info->use_count) ==0 ) { +if (atomic_read (&ddi->use_count) ==0 ) {// device is idle => we save immediately pr_info ("All DCSSs that map to device %s are " -"saved\n" , dev_info->segment_name); -list_for_each_entry (entry, &dev_info->seg_list, lh) { +"saved\n" , ddi->segment_name); +list_for_each_entry (entry, &ddi->seg_list, lh) {segment_save (entry->segment_name); } }else {
@@ -457,17 +457,17 @@ dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char// idle in dcssblk_release pr_info ("Device %s is in use, its DCSSs will be " "saved when it becomes idle\n" , - dev_info->segment_name); - dev_info->save_pending =1 ; + ddi->segment_name); + ddi->save_pending =1 ; } }else if (inbuf[0 ] =='0' ) { -if (dev_info->save_pending) { +if (ddi->save_pending) {// device is busy & the user wants to undo his save // request - dev_info->save_pending =0 ; + ddi->save_pending =0 ;pr_info ("A pending save request for device %s " "has been canceled\n" , - dev_info->segment_name); + ddi->segment_name); } }else {up_write (&dcssblk_devices_sem);
@@ -486,14 +486,14 @@ dcssblk_seglist_show(struct device *dev, struct device_attribute *attr, {int i; -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct segment_info *entry;down_read (&dcssblk_devices_sem); - dev_info = container_of(dev, struct dcssblk_dev_info, dev); + ddi = container_of(dev, struct dcssblk_dev_info, dev); i =0 ; buf[0 ] ='\0' ; -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) {strcpy (&buf[i], entry->segment_name); i +=strlen (entry->segment_name); buf[i] ='\n' ;
@@ -510,12 +510,12 @@ static ssize_t dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int rc, i, j, num_of_segments; -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct segment_info *seg_info, *temp;char *local_buf;unsigned long seg_byte_size; - dev_info =NULL ; + ddi =NULL ; seg_info =NULL ;if (dev != dcssblk_root_dev) { rc = -EINVAL ;
@@ -556,17 +556,17 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char* get a struct dcssblk_dev_info */ if (num_of_segments ==0 ) { - dev_info =kzalloc (sizeof (struct dcssblk_dev_info ), + ddi =kzalloc (sizeof (struct dcssblk_dev_info ),GFP_KERNEL ); -if (dev_info ==NULL ) { +if (ddi ==NULL ) { rc = -ENOMEM ; goto out; } -strcpy (dev_info->segment_name, local_buf); - dev_info->segment_type = seg_info->segment_type; -INIT_LIST_HEAD (&dev_info->seg_list); +strcpy (ddi->segment_name, local_buf); + ddi->segment_type = seg_info->segment_type; +INIT_LIST_HEAD (&ddi->seg_list); } -list_add_tail (&seg_info->lh, &dev_info->seg_list); +list_add_tail (&seg_info->lh, &ddi->seg_list); num_of_segments++; i = j;
@@ -580,39 +580,39 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char goto seg_list_del; }strlcpy (local_buf, buf, i +1 ); - dev_info->num_of_segments = num_of_segments; - rc =dcssblk_is_continuous (dev_info); + ddi->num_of_segments = num_of_segments; + rc =dcssblk_is_continuous (ddi);if (rc <0 ) goto seg_list_del; - dev_info->start =dcssblk_find_lowest_addr (dev_info); - dev_info->end =dcssblk_find_highest_addr (dev_info); + ddi->start =dcssblk_find_lowest_addr (ddi); + ddi->end =dcssblk_find_highest_addr (ddi); -dev_set_name (&dev_info->dev, dev_info->segment_name); - dev_info->dev.release = dcssblk_release_segment; -INIT_LIST_HEAD (&dev_info->lh); - dev_info->gd =alloc_disk (DCSSBLK_MINORS_PER_DISK ); -if (dev_info->gd ==NULL ) { +dev_set_name (&ddi->dev, ddi->segment_name); + ddi->dev.release = dcssblk_release_segment; +INIT_LIST_HEAD (&ddi->lh); + ddi->gd =alloc_disk (DCSSBLK_MINORS_PER_DISK ); +if (ddi->gd ==NULL ) { rc = -ENOMEM ; goto seg_list_del; } - dev_info->gd->major = dcssblk_major; - dev_info->gd->fops = &dcssblk_devops; - dev_info->dcssblk_queue =blk_alloc_queue (GFP_KERNEL ); - dev_info->gd->queue = dev_info->dcssblk_queue; - dev_info->gd->private_data = dev_info; - dev_info->gd->driverfs_dev = &dev_info->dev; -blk_queue_make_request (dev_info->dcssblk_queue, dcssblk_make_request); -blk_queue_logical_block_size (dev_info->dcssblk_queue,4096 ); - - seg_byte_size = (dev_info->end - dev_info->start +1 ); -set_capacity (dev_info->gd, seg_byte_size >>9 );// size in sectors + ddi->gd->major = dcssblk_major; + ddi->gd->fops = &dcssblk_devops; + ddi->dcssblk_queue =blk_alloc_queue (GFP_KERNEL ); + ddi->gd->queue = ddi->dcssblk_queue; + ddi->gd->private_data = ddi; + ddi->gd->driverfs_dev = &ddi->dev; +blk_queue_make_request (ddi->dcssblk_queue, dcssblk_make_request); +blk_queue_logical_block_size (ddi->dcssblk_queue,4096 ); + + seg_byte_size = (ddi->end - ddi->start +1 ); +set_capacity (ddi->gd, seg_byte_size >>9 );// size in sectors pr_info ("Loaded %s with total size %lu bytes and capacity %lu " "sectors\n" , local_buf, seg_byte_size, seg_byte_size >>9 ); - dev_info->save_pending =0 ; - dev_info->is_shared =1 ; - dev_info->dev.parent = dcssblk_root_dev; + ddi->save_pending =0 ; + ddi->is_shared =1 ; + ddi->dev.parent = dcssblk_root_dev;/* *get minor, add to list
@@ -622,12 +622,12 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char rc = -EEXIST ; goto release_gd; } - rc =dcssblk_assign_free_minor (dev_info); + rc =dcssblk_assign_free_minor (ddi);if (rc) goto release_gd; -sprintf (dev_info->gd->disk_name,"dcssblk%d" , - dev_info->gd->first_minor); -list_add_tail (&dev_info->lh, &dcssblk_devices); +sprintf (ddi->gd->disk_name,"dcssblk%d" , + ddi->gd->first_minor); +list_add_tail (&ddi->lh, &dcssblk_devices);if (!try_module_get (THIS_MODULE )) { rc = -ENODEV ;
@@ -636,32 +636,32 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char/* * register the device */ - rc =device_register (&dev_info->dev); + rc =device_register (&ddi->dev);if (rc) {module_put (THIS_MODULE ); goto dev_list_del; } -get_device (&dev_info->dev); - rc =device_create_file (&dev_info->dev, &dev_attr_shared); +get_device (&ddi->dev); + rc =device_create_file (&ddi->dev, &dev_attr_shared);if (rc) goto unregister_dev; - rc =device_create_file (&dev_info->dev, &dev_attr_save); + rc =device_create_file (&ddi->dev, &dev_attr_save);if (rc) goto unregister_dev; - rc =device_create_file (&dev_info->dev, &dev_attr_seglist); + rc =device_create_file (&ddi->dev, &dev_attr_seglist);if (rc) goto unregister_dev; -add_disk (dev_info->gd); +add_disk (ddi->gd); -switch (dev_info->segment_type) { +switch (ddi->segment_type) {case SEG_TYPE_SR :case SEG_TYPE_ER :case SEG_TYPE_SC : -set_disk_ro (dev_info->gd,1 ); +set_disk_ro (ddi->gd,1 );break ;default : -set_disk_ro (dev_info->gd,0 ); +set_disk_ro (ddi->gd,0 );break ; }up_write (&dcssblk_devices_sem);
@@ -669,33 +669,33 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char goto out; unregister_dev: -list_del (&dev_info->lh); -blk_cleanup_queue (dev_info->dcssblk_queue); - dev_info->gd->queue =NULL ; -put_disk (dev_info->gd); -device_unregister (&dev_info->dev); -list_for_each_entry (seg_info, &dev_info->seg_list, lh) { +list_del (&ddi->lh); +blk_cleanup_queue (ddi->dcssblk_queue); + ddi->gd->queue =NULL ; +put_disk (ddi->gd); +device_unregister (&ddi->dev); +list_for_each_entry (seg_info, &ddi->seg_list, lh) {segment_unload (seg_info->segment_name); } -put_device (&dev_info->dev); +put_device (&ddi->dev);up_write (&dcssblk_devices_sem); goto out; dev_list_del: -list_del (&dev_info->lh); +list_del (&ddi->lh); release_gd: -blk_cleanup_queue (dev_info->dcssblk_queue); - dev_info->gd->queue =NULL ; -put_disk (dev_info->gd); +blk_cleanup_queue (ddi->dcssblk_queue); + ddi->gd->queue =NULL ; +put_disk (ddi->gd);up_write (&dcssblk_devices_sem); seg_list_del: -if (dev_info ==NULL ) +if (ddi ==NULL ) goto out; -list_for_each_entry_safe (seg_info, temp, &dev_info->seg_list, lh) { +list_for_each_entry_safe (seg_info, temp, &ddi->seg_list, lh) {list_del (&seg_info->lh);segment_unload (seg_info->segment_name);kfree (seg_info); } -kfree (dev_info); +kfree (ddi); out:kfree (local_buf); out_nobuf:
@@ -708,7 +708,7 @@ out_nobuf:static ssize_t dcssblk_remove_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct segment_info *entry;int rc, i;char *local_buf;
@@ -733,15 +733,15 @@ dcssblk_remove_store(struct device *dev, struct device_attribute *attr, const ch }down_write (&dcssblk_devices_sem); - dev_info =dcssblk_get_device_by_name (local_buf); -if (dev_info ==NULL ) { + ddi =dcssblk_get_device_by_name (local_buf); +if (ddi ==NULL ) {up_write (&dcssblk_devices_sem);pr_warning ("Device %s cannot be removed because it is not a " "known device\n" , local_buf); rc = -ENODEV ; goto out_buf; } -if (atomic_read (&dev_info->use_count) !=0 ) { +if (atomic_read (&ddi->use_count) !=0 ) {up_write (&dcssblk_devices_sem);pr_warning ("Device %s cannot be removed while it is in " "use\n" , local_buf);
@@ -749,18 +749,18 @@ dcssblk_remove_store(struct device *dev, struct device_attribute *attr, const ch goto out_buf; } -list_del (&dev_info->lh); -del_gendisk (dev_info->gd); -blk_cleanup_queue (dev_info->dcssblk_queue); - dev_info->gd->queue =NULL ; -put_disk (dev_info->gd); -device_unregister (&dev_info->dev); +list_del (&ddi->lh); +del_gendisk (ddi->gd); +blk_cleanup_queue (ddi->dcssblk_queue); + ddi->gd->queue =NULL ; +put_disk (ddi->gd); +device_unregister (&ddi->dev);/* unload all related segments */ -list_for_each_entry (entry, &dev_info->seg_list, lh) +list_for_each_entry (entry, &ddi->seg_list, lh)segment_unload (entry->segment_name); -put_device (&dev_info->dev); +put_device (&ddi->dev);up_write (&dcssblk_devices_sem); rc = count;
@@ -772,15 +772,15 @@ out_buf:static int dcssblk_open (struct block_device *bdev,fmode_t mode) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;int rc; - dev_info = bdev->bd_disk->private_data; -if (NULL == dev_info) { + ddi = bdev->bd_disk->private_data; +if (NULL == ddi) { rc = -ENODEV ; goto out; } -atomic_inc (&dev_info->use_count); +atomic_inc (&ddi->use_count); bdev->bd_block_size =4096 ; rc =0 ; out:
@@ -790,23 +790,23 @@ out:static int dcssblk_release (struct gendisk *disk,fmode_t mode) { -struct dcssblk_dev_info *dev_info = disk->private_data; +struct dcssblk_dev_info *ddi = disk->private_data;struct segment_info *entry;int rc; -if (!dev_info) { +if (!ddi) { rc = -ENODEV ; goto out; }down_write (&dcssblk_devices_sem); -if (atomic_dec_and_test (&dev_info->use_count) - && (dev_info->save_pending)) { +if (atomic_dec_and_test (&ddi->use_count) + && (ddi->save_pending)) {pr_info ("Device %s has become idle and is being saved " -"now\n" , dev_info->segment_name); -list_for_each_entry (entry, &dev_info->seg_list, lh) { +"now\n" , ddi->segment_name); +list_for_each_entry (entry, &ddi->seg_list, lh) {segment_save (entry->segment_name); } - dev_info->save_pending =0 ; + ddi->save_pending =0 ; }up_write (&dcssblk_devices_sem); rc =0 ;
@@ -817,7 +817,7 @@ out:static int dcssblk_make_request (struct request_queue *q,struct bio *bio) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct bio_vec *bvec;unsigned long index;unsigned long page_addr;
@@ -826,8 +826,8 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio)int i; bytes_done =0 ; - dev_info = bio->bi_bdev->bd_disk->private_data; -if (dev_info ==NULL ) + ddi = bio->bi_bdev->bd_disk->private_data; +if (ddi ==NULL ) goto fail;if ((bio->bi_sector &7 ) !=0 || (bio->bi_size &4095 ) !=0 )/* Request is not page-aligned. */
@@ -838,8 +838,8 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio) goto fail; }/* verify data transfer direction */ -if (dev_info->is_shared) { -switch (dev_info->segment_type) { +if (ddi->is_shared) { +switch (ddi->segment_type) {case SEG_TYPE_SR :case SEG_TYPE_ER :case SEG_TYPE_SC :
@@ -847,7 +847,7 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio)if (bio_data_dir (bio) ==WRITE ) {pr_warning ("Writing to %s failed because it " "is a read-only device\n" , -dev_name (&dev_info->dev)); +dev_name (&ddi->dev)); goto fail; } }
@@ -857,7 +857,7 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio)bio_for_each_segment (bvec, bio, i) { page_addr = (unsigned long )page_address (bvec->bv_page) + bvec->bv_offset; - source_addr = dev_info->start + (index<<12 ) + bytes_done; + source_addr = ddi->start + (index<<12 ) + bytes_done;if (unlikely ((page_addr &4095 ) !=0 ) || (bvec->bv_len &4095 ) !=0 )// More paranoia. goto fail;
@@ -881,18 +881,18 @@ static int dcssblk_direct_access (struct block_device *bdev, sector_t secnum, void **kaddr, unsigned long *pfn) { - struct dcssblk_dev_info *dev_info; + struct dcssblk_dev_info *ddi;unsigned long pgoff; - dev_info = bdev->bd_disk->private_data; -if (!dev_info) + ddi = bdev->bd_disk->private_data; +if (!ddi)return -ENODEV ;if (secnum % (PAGE_SIZE /512 ))return -EINVAL ; pgoff = secnum / (PAGE_SIZE /512 ); -if ((pgoff+1 )*PAGE_SIZE -1 > dev_info->end - dev_info->start) +if ((pgoff+1 )*PAGE_SIZE -1 > ddi->end - ddi->start)return -ERANGE ; - *kaddr = (void *) (dev_info->start+pgoff*PAGE_SIZE ); + *kaddr = (void *) (ddi->start+pgoff*PAGE_SIZE ); *pfn =virt_to_phys (*kaddr) >>PAGE_SHIFT ;return 0 ;
@@ -903,7 +903,7 @@ dcssblk_check_params(void) {int rc, i, j, k;char buf[DCSSBLK_PARM_LEN +1 ]; -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;for (i =0 ; (i <DCSSBLK_PARM_LEN ) && (dcssblk_segments[i] !='\0' ); i++) {
@@ -922,10 +922,10 @@ dcssblk_check_params(void) buf[k] ='\0' ;if (!strncmp (&dcssblk_segments[j],"(local)" ,7 )) {down_read (&dcssblk_devices_sem); - dev_info =dcssblk_get_device_by_name (buf); + ddi =dcssblk_get_device_by_name (buf);up_read (&dcssblk_devices_sem); -if (dev_info) -dcssblk_shared_store (&dev_info->dev, +if (ddi) +dcssblk_shared_store (&ddi->dev,NULL ,"0\n" ,2 ); } }
@@ -945,15 +945,15 @@ dcssblk_check_params(void)*/ static int dcssblk_freeze (struct device *dev) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;int rc =0 ; -list_for_each_entry (dev_info, &dcssblk_devices, lh) { -switch (dev_info->segment_type) { +list_for_each_entry (ddi, &dcssblk_devices, lh) { +switch (ddi->segment_type) {case SEG_TYPE_SR :case SEG_TYPE_ER :case SEG_TYPE_SC : -if (!dev_info->is_shared) +if (!ddi->is_shared) rc = -EINVAL ;break ;default :
@@ -966,19 +966,19 @@ static int dcssblk_freeze(struct device *dev)if (rc)pr_err ("Suspending the system failed because DCSS device %s " "is writable\n" , - dev_info->segment_name); + ddi->segment_name);return rc; }static int dcssblk_restore (struct device *dev) { -struct dcssblk_dev_info *dev_info; +struct dcssblk_dev_info *ddi;struct segment_info *entry;unsigned long start, end;int rc =0 ; -list_for_each_entry (dev_info, &dcssblk_devices, lh) { -list_for_each_entry (entry, &dev_info->seg_list, lh) { +list_for_each_entry (ddi, &dcssblk_devices, lh) { +list_for_each_entry (entry, &ddi->seg_list, lh) {segment_unload (entry->segment_name); rc =segment_load (entry->segment_name,SEGMENT_SHARED , &start, &end);
Signature · 1 line
1.7.0.3.311.g6a6955
PATCH 5/11 drivers/edac/amd: Rename dev_info to adi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/edac/amd8111_edac.c | 88 +++++++++++++++++++++--------------------- drivers/edac/amd8131_edac.c | 86 +++++++++++++++++++++--------------------- 2 files changed, 87 insertions(+), 87 deletions(-)
drivers/edac/amd8111_edac.c +44 -44
@@ -243,10 +243,10 @@ static int at_compat_reg_broken;#define LEGACY_NR_PORTS 1/* device-specific methods for amd8111 LPC Bridge device */ -static void amd8111_lpc_bridge_init (struct amd8111_dev_info *dev_info) +static void amd8111_lpc_bridge_init (struct amd8111_dev_info *adi) {u8 val8; -struct pci_dev *dev = dev_info->dev; +struct pci_dev *dev = adi->dev;/* First clear REG_AT_COMPAT[SERR, IOCHK] if necessary */ legacy_io_res = request_region(REG_AT_COMPAT, LEGACY_NR_PORTS,
@@ -280,7 +280,7 @@ static void amd8111_lpc_bridge_init(struct amd8111_dev_info *dev_info)edac_pci_write_byte (dev,REG_IO_CTRL_1 , val8); } -static void amd8111_lpc_bridge_exit (struct amd8111_dev_info *dev_info) +static void amd8111_lpc_bridge_exit (struct amd8111_dev_info *adi) {if (legacy_io_res)release_region (REG_AT_COMPAT ,LEGACY_NR_PORTS );
@@ -288,15 +288,15 @@ static void amd8111_lpc_bridge_exit(struct amd8111_dev_info *dev_info)static void amd8111_lpc_bridge_check (struct edac_device_ctl_info *edac_dev) { -struct amd8111_dev_info *dev_info = edac_dev->pvt_info; -struct pci_dev *dev = dev_info->dev; +struct amd8111_dev_info *adi = edac_dev->pvt_info; +struct pci_dev *dev = adi->dev;u8 val8;edac_pci_read_byte (dev,REG_IO_CTRL_1 , &val8);if (val8 &IO_CTRL_1_CLEAR_MASK ) {printk (KERN_INFO "Error(s) in IO control register on %s device\n" , - dev_info->ctl_name); + adi->ctl_name);printk (KERN_INFO "LPC ERR: %d, PW2LPC: %d\n" , (val8 &IO_CTRL_1_LPC_ERR ) !=0 , (val8 &IO_CTRL_1_PW2LPC ) !=0 );
@@ -349,25 +349,25 @@ static struct amd8111_pci_info amd8111_pcis[] = {static int amd8111_dev_probe (struct pci_dev *dev,const struct pci_device_id *id) { -struct amd8111_dev_info *dev_info = &amd8111_devices[id->driver_data]; +struct amd8111_dev_info *adi = &amd8111_devices[id->driver_data]; - dev_info->dev =pci_get_device (PCI_VENDOR_ID_AMD , - dev_info->err_dev,NULL ); + adi->dev =pci_get_device (PCI_VENDOR_ID_AMD , + adi->err_dev,NULL ); -if (!dev_info->dev) { +if (!adi->dev) {printk (KERN_ERR "EDAC device not found:" "vendor %x, device %x, name %s\n" , -PCI_VENDOR_ID_AMD , dev_info->err_dev, - dev_info->ctl_name); +PCI_VENDOR_ID_AMD , adi->err_dev, + adi->ctl_name);return -ENODEV ; } -if (pci_enable_device (dev_info->dev)) { -pci_dev_put (dev_info->dev); +if (pci_enable_device (adi->dev)) { +pci_dev_put (adi->dev);printk (KERN_ERR "failed to enable:" "vendor %x, device %x, name %s\n" , -PCI_VENDOR_ID_AMD , dev_info->err_dev, - dev_info->ctl_name); +PCI_VENDOR_ID_AMD , adi->err_dev, + adi->ctl_name);return -ENODEV ; }
@@ -376,61 +376,61 @@ static int amd8111_dev_probe(struct pci_dev *dev,* edac_device_ctl_info, but make use of existing * one instead. */ - dev_info->edac_idx =edac_device_alloc_index (); - dev_info->edac_dev = -edac_device_alloc_ctl_info (0 , dev_info->ctl_name,1 , + adi->edac_idx =edac_device_alloc_index (); + adi->edac_dev = +edac_device_alloc_ctl_info (0 , adi->ctl_name,1 ,NULL ,0 ,0 , -NULL ,0 , dev_info->edac_idx); -if (!dev_info->edac_dev) +NULL ,0 , adi->edac_idx); +if (!adi->edac_dev)return -ENOMEM ; - dev_info->edac_dev->pvt_info = dev_info; - dev_info->edac_dev->dev = &dev_info->dev->dev; - dev_info->edac_dev->mod_name =AMD8111_EDAC_MOD_STR ; - dev_info->edac_dev->ctl_name = dev_info->ctl_name; - dev_info->edac_dev->dev_name =dev_name (&dev_info->dev->dev); + adi->edac_dev->pvt_info = adi; + adi->edac_dev->dev = &adi->dev->dev; + adi->edac_dev->mod_name =AMD8111_EDAC_MOD_STR ; + adi->edac_dev->ctl_name = adi->ctl_name; + adi->edac_dev->dev_name =dev_name (&adi->dev->dev);if (edac_op_state ==EDAC_OPSTATE_POLL ) - dev_info->edac_dev->edac_check = dev_info->check; + adi->edac_dev->edac_check = adi->check; -if (dev_info->init) - dev_info->init (dev_info); +if (adi->init) + adi->init (adi); -if (edac_device_add_device (dev_info->edac_dev) >0 ) { +if (edac_device_add_device (adi->edac_dev) >0 ) {printk (KERN_ERR "failed to add edac_dev for %s\n" , - dev_info->ctl_name); -edac_device_free_ctl_info (dev_info->edac_dev); + adi->ctl_name); +edac_device_free_ctl_info (adi->edac_dev);return -ENODEV ; }printk (KERN_INFO "added one edac_dev on AMD8111 " "vendor %x, device %x, name %s\n" , -PCI_VENDOR_ID_AMD , dev_info->err_dev, - dev_info->ctl_name); +PCI_VENDOR_ID_AMD , adi->err_dev, + adi->ctl_name);return 0 ; }static void amd8111_dev_remove (struct pci_dev *dev) { -struct amd8111_dev_info *dev_info; +struct amd8111_dev_info *adi; -for (dev_info = amd8111_devices; dev_info->err_dev; dev_info++) -if (dev_info->dev->device == dev->device) +for (adi = amd8111_devices; adi->err_dev; adi++) +if (adi->dev->device == dev->device)break ; -if (!dev_info->err_dev)/* should never happen */ +if (!adi->err_dev)/* should never happen */ return ; -if (dev_info->edac_dev) { -edac_device_del_device (dev_info->edac_dev->dev); -edac_device_free_ctl_info (dev_info->edac_dev); +if (adi->edac_dev) { +edac_device_del_device (adi->edac_dev->dev); +edac_device_free_ctl_info (adi->edac_dev); } -if (dev_info->exit) - dev_info->exit (dev_info); +if (adi->exit) + adi->exit (adi); -pci_dev_put (dev_info->dev); +pci_dev_put (adi->dev); } static int amd8111_pci_probe(struct pci_dev *dev,
drivers/edac/amd8131_edac.c +43 -43
186 lines not on this page · raw message
Signature · 1 line
1.7.0.3.311.g6a6955
PATCH 6/11 drivers/edac/cpc925_edac.c: Rename dev_info to cdi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/edac/cpc925_edac.c | 122 ++++++++++++++++++++++---------------------- 1 files changed, 61 insertions(+), 61 deletions(-)
drivers/edac/cpc925_edac.c +61 -61
@@ -286,8 +286,8 @@ struct cpc925_dev_info {char *ctl_name;int edac_idx;struct edac_device_ctl_info *edac_dev; -void (*init)(struct cpc925_dev_info *dev_info); -void (*exit)(struct cpc925_dev_info *dev_info); +void (*init)(struct cpc925_dev_info *cdi); +void (*exit)(struct cpc925_dev_info *cdi);void (*check)(struct edac_device_ctl_info *edac_dev); };
@@ -581,19 +581,19 @@ static void cpc925_mc_check(struct mem_ctl_info *mci)/******************** CPU err device********************************/ /* Enable CPU Errors detection */ -static void cpc925_cpu_init (struct cpc925_dev_info *dev_info) +static void cpc925_cpu_init (struct cpc925_dev_info *cdi) {u32 apimask; - apimask =__raw_readl (dev_info->vbase +REG_APIMASK_OFFSET ); + apimask =__raw_readl (cdi->vbase +REG_APIMASK_OFFSET );if ((apimask &CPU_MASK_ENABLE ) ==0 ) { apimask |=CPU_MASK_ENABLE ; -__raw_writel (apimask, dev_info->vbase +REG_APIMASK_OFFSET ); +__raw_writel (apimask, cdi->vbase +REG_APIMASK_OFFSET ); } }/* Disable CPU Errors detection */ -static void cpc925_cpu_exit (struct cpc925_dev_info *dev_info) +static void cpc925_cpu_exit (struct cpc925_dev_info *cdi) {/* * WARNING:
@@ -612,16 +612,16 @@ static void cpc925_cpu_exit(struct cpc925_dev_info *dev_info)/* Check for CPU Errors */ static void cpc925_cpu_check (struct edac_device_ctl_info *edac_dev) { -struct cpc925_dev_info *dev_info = edac_dev->pvt_info; +struct cpc925_dev_info *cdi = edac_dev->pvt_info;u32 apiexcp;u32 apimask;/* APIEXCP is cleared when read */ - apiexcp =__raw_readl (dev_info->vbase +REG_APIEXCP_OFFSET ); + apiexcp =__raw_readl (cdi->vbase +REG_APIEXCP_OFFSET );if ((apiexcp &CPU_EXCP_DETECTED ) ==0 )return ; - apimask =__raw_readl (dev_info->vbase +REG_APIMASK_OFFSET ); + apimask =__raw_readl (cdi->vbase +REG_APIMASK_OFFSET );cpc925_printk (KERN_INFO ,"Processor Interface Fault\n" "Processor Interface register dump:\n" );cpc925_printk (KERN_INFO ,"APIMASK 0x%08x\n" , apimask);
@@ -632,35 +632,35 @@ static void cpc925_cpu_check(struct edac_device_ctl_info *edac_dev)/******************** HT Link err device****************************/ /* Enable HyperTransport Link Error detection */ -static void cpc925_htlink_init (struct cpc925_dev_info *dev_info) +static void cpc925_htlink_init (struct cpc925_dev_info *cdi) {u32 ht_errctrl; - ht_errctrl =__raw_readl (dev_info->vbase +REG_ERRCTRL_OFFSET ); + ht_errctrl =__raw_readl (cdi->vbase +REG_ERRCTRL_OFFSET );if ((ht_errctrl &HT_ERRCTRL_ENABLE ) ==0 ) { ht_errctrl |=HT_ERRCTRL_ENABLE ; -__raw_writel (ht_errctrl, dev_info->vbase +REG_ERRCTRL_OFFSET ); +__raw_writel (ht_errctrl, cdi->vbase +REG_ERRCTRL_OFFSET ); } }/* Disable HyperTransport Link Error detection */ -static void cpc925_htlink_exit (struct cpc925_dev_info *dev_info) +static void cpc925_htlink_exit (struct cpc925_dev_info *cdi) {u32 ht_errctrl; - ht_errctrl =__raw_readl (dev_info->vbase +REG_ERRCTRL_OFFSET ); + ht_errctrl =__raw_readl (cdi->vbase +REG_ERRCTRL_OFFSET ); ht_errctrl &= ~HT_ERRCTRL_ENABLE ; -__raw_writel (ht_errctrl, dev_info->vbase +REG_ERRCTRL_OFFSET ); +__raw_writel (ht_errctrl, cdi->vbase +REG_ERRCTRL_OFFSET ); }/* Check for HyperTransport Link errors */ static void cpc925_htlink_check (struct edac_device_ctl_info *edac_dev) { -struct cpc925_dev_info *dev_info = edac_dev->pvt_info; -u32 brgctrl =__raw_readl (dev_info->vbase +REG_BRGCTRL_OFFSET ); -u32 linkctrl =__raw_readl (dev_info->vbase +REG_LINKCTRL_OFFSET ); -u32 errctrl =__raw_readl (dev_info->vbase +REG_ERRCTRL_OFFSET ); -u32 linkerr =__raw_readl (dev_info->vbase +REG_LINKERR_OFFSET ); +struct cpc925_dev_info *cdi = edac_dev->pvt_info; +u32 brgctrl =__raw_readl (cdi->vbase +REG_BRGCTRL_OFFSET ); +u32 linkctrl =__raw_readl (cdi->vbase +REG_LINKCTRL_OFFSET ); +u32 errctrl =__raw_readl (cdi->vbase +REG_ERRCTRL_OFFSET ); +u32 linkerr =__raw_readl (cdi->vbase +REG_LINKERR_OFFSET ); if (!((brgctrl & BRGCTRL_DETSERR) || (linkctrl & HT_LINKCTRL_DETECTED) ||
@@ -682,24 +682,24 @@ static void cpc925_htlink_check(struct edac_device_ctl_info *edac_dev)/* Clear by write 1 */ if (brgctrl &BRGCTRL_DETSERR )__raw_writel (BRGCTRL_DETSERR , - dev_info->vbase +REG_BRGCTRL_OFFSET ); + cdi->vbase +REG_BRGCTRL_OFFSET );if (linkctrl &HT_LINKCTRL_DETECTED )__raw_writel (HT_LINKCTRL_DETECTED , - dev_info->vbase +REG_LINKCTRL_OFFSET ); + cdi->vbase +REG_LINKCTRL_OFFSET );/* Initiate Secondary Bus Reset to clear the chain failure */ if (errctrl &ERRCTRL_CHN_FAL )__raw_writel (BRGCTRL_SECBUSRESET , - dev_info->vbase +REG_BRGCTRL_OFFSET ); + cdi->vbase +REG_BRGCTRL_OFFSET );if (errctrl &ERRCTRL_RSP_ERR )__raw_writel (ERRCTRL_RSP_ERR , - dev_info->vbase +REG_ERRCTRL_OFFSET ); + cdi->vbase +REG_ERRCTRL_OFFSET );if (linkerr &HT_LINKERR_DETECTED )__raw_writel (HT_LINKERR_DETECTED , - dev_info->vbase +REG_LINKERR_OFFSET ); + cdi->vbase +REG_LINKERR_OFFSET );edac_device_handle_ce (edac_dev,0 ,0 , edac_dev->ctl_name); }
@@ -729,21 +729,21 @@ static struct cpc925_dev_info cpc925_devs[] = {*/ static void cpc925_add_edac_devices (void __iomem *vbase) { -struct cpc925_dev_info *dev_info; +struct cpc925_dev_info *cdi;if (!vbase) {cpc925_printk (KERN_ERR ,"MMIO not established yet\n" );return ; } -for (dev_info = &cpc925_devs[0 ]; dev_info->init; dev_info++) { - dev_info->vbase = vbase; - dev_info->pdev =platform_device_register_simple ( - dev_info->ctl_name,0 ,NULL ,0 ); -if (IS_ERR (dev_info->pdev)) { +for (cdi = &cpc925_devs[0 ]; cdi->init; cdi++) { + cdi->vbase = vbase; + cdi->pdev =platform_device_register_simple ( + cdi->ctl_name,0 ,NULL ,0 ); +if (IS_ERR (cdi->pdev)) {cpc925_printk (KERN_ERR ,"Can't register platform device for %s\n" , - dev_info->ctl_name); + cdi->ctl_name);continue ; }
@@ -751,45 +751,45 @@ static void cpc925_add_edac_devices(void __iomem *vbase)* Don't have to allocate private structure but * make use of cpc925_devs[] instead. */ - dev_info->edac_idx =edac_device_alloc_index (); - dev_info->edac_dev = -edac_device_alloc_ctl_info (0 , dev_info->ctl_name, -1 ,NULL ,0 ,0 ,NULL ,0 , dev_info->edac_idx); -if (!dev_info->edac_dev) { + cdi->edac_idx =edac_device_alloc_index (); + cdi->edac_dev = +edac_device_alloc_ctl_info (0 , cdi->ctl_name, +1 ,NULL ,0 ,0 ,NULL ,0 , cdi->edac_idx); +if (!cdi->edac_dev) {cpc925_printk (KERN_ERR ,"No memory for edac device\n" ); goto err1; } - dev_info->edac_dev->pvt_info = dev_info; - dev_info->edac_dev->dev = &dev_info->pdev->dev; - dev_info->edac_dev->ctl_name = dev_info->ctl_name; - dev_info->edac_dev->mod_name =CPC925_EDAC_MOD_STR ; - dev_info->edac_dev->dev_name =dev_name (&dev_info->pdev->dev); + cdi->edac_dev->pvt_info = cdi; + cdi->edac_dev->dev = &cdi->pdev->dev; + cdi->edac_dev->ctl_name = cdi->ctl_name; + cdi->edac_dev->mod_name =CPC925_EDAC_MOD_STR ; + cdi->edac_dev->dev_name =dev_name (&cdi->pdev->dev);if (edac_op_state ==EDAC_OPSTATE_POLL ) - dev_info->edac_dev->edac_check = dev_info->check; + cdi->edac_dev->edac_check = cdi->check; -if (dev_info->init) - dev_info->init (dev_info); +if (cdi->init) + cdi->init (cdi); -if (edac_device_add_device (dev_info->edac_dev) >0 ) { +if (edac_device_add_device (cdi->edac_dev) >0 ) {cpc925_printk (KERN_ERR ,"Unable to add edac device for %s\n" , - dev_info->ctl_name); + cdi->ctl_name); goto err2; }debugf0 ("%s: Successfully added edac device for %s\n" , - __func__, dev_info->ctl_name); + __func__, cdi->ctl_name);continue ; err2: -if (dev_info->exit) - dev_info->exit (dev_info); -edac_device_free_ctl_info (dev_info->edac_dev); +if (cdi->exit) + cdi->exit (cdi); +edac_device_free_ctl_info (cdi->edac_dev); err1: -platform_device_unregister (dev_info->pdev); +platform_device_unregister (cdi->pdev); } }
@@ -799,20 +799,20 @@ err1:*/ static void cpc925_del_edac_devices (void ) { -struct cpc925_dev_info *dev_info; +struct cpc925_dev_info *cdi; -for (dev_info = &cpc925_devs[0 ]; dev_info->init; dev_info++) { -if (dev_info->edac_dev) { -edac_device_del_device (dev_info->edac_dev->dev); -edac_device_free_ctl_info (dev_info->edac_dev); -platform_device_unregister (dev_info->pdev); +for (cdi = &cpc925_devs[0 ]; cdi->init; cdi++) { +if (cdi->edac_dev) { +edac_device_del_device (cdi->edac_dev->dev); +edac_device_free_ctl_info (cdi->edac_dev); +platform_device_unregister (cdi->pdev); } -if (dev_info->exit) - dev_info->exit (dev_info); +if (cdi->exit) + cdi->exit (cdi);debugf0 ("%s: Successfully deleted edac device for %s\n" , - __func__, dev_info->ctl_name); + __func__, cdi->ctl_name); } }
Signature · 1 line
1.7.0.3.311.g6a6955
PATCH 7/11 drivers/edac/e7*_edac.c: Rename dev_info to edi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/edac/e752x_edac.c | 18 +++++++++--------- drivers/edac/e7xxx_edac.c | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/edac/e752x_edac.c +9 -9
@@ -198,7 +198,7 @@ struct e752x_pvt {int mc_symmetric;u8 map[8 ];int map_type; -const struct e752x_dev_info *dev_info; +const struct e752x_dev_info *edi; };struct e752x_dev_info {
@@ -820,7 +820,7 @@ static void e752x_get_error_info(struct mem_ctl_info *mci,pci_read_config_dword (dev,E752X_FERR_GLOBAL , &info->ferr_global);if (info->ferr_global) { -if (pvt->dev_info->err_dev ==PCI_DEVICE_ID_INTEL_3100_1_ERR ) { +if (pvt->edi->err_dev ==PCI_DEVICE_ID_INTEL_3100_1_ERR ) {pci_read_config_dword (dev,I3100_NSI_FERR , &info->nsi_ferr); info->hi_ferr =0 ;
@@ -872,7 +872,7 @@ static void e752x_get_error_info(struct mem_ctl_info *mci,pci_read_config_dword (dev,E752X_NERR_GLOBAL , &info->nerr_global);if (info->nerr_global) { -if (pvt->dev_info->err_dev ==PCI_DEVICE_ID_INTEL_3100_1_ERR ) { +if (pvt->edi->err_dev ==PCI_DEVICE_ID_INTEL_3100_1_ERR ) {pci_read_config_dword (dev,I3100_NSI_NERR , &info->nsi_nerr); info->hi_nerr =0 ;
@@ -966,7 +966,7 @@ static int set_sdram_scrub_rate(struct mem_ctl_info *mci, u32 *new_bw)struct pci_dev *pdev = pvt->dev_d0f0;int i; -if (pvt->dev_info->ctl_dev ==PCI_DEVICE_ID_INTEL_3100_0 ) +if (pvt->edi->ctl_dev ==PCI_DEVICE_ID_INTEL_3100_0 ) scrubrates = scrubrates_i3100;else scrubrates = scrubrates_e752x;
@@ -996,7 +996,7 @@ static int get_sdram_scrub_rate(struct mem_ctl_info *mci, u32 *bw)u16 scrubval;int i; -if (pvt->dev_info->ctl_dev ==PCI_DEVICE_ID_INTEL_3100_0 ) +if (pvt->edi->ctl_dev ==PCI_DEVICE_ID_INTEL_3100_0 ) scrubrates = scrubrates_i3100;else scrubrates = scrubrates_e752x;
@@ -1146,7 +1146,7 @@ static int e752x_get_devs(struct pci_dev *pdev, int dev_idx,struct pci_dev *dev; pvt->bridge_ck =pci_get_device (PCI_VENDOR_ID_INTEL , - pvt->dev_info->err_dev, pvt->bridge_ck); + pvt->edi->err_dev, pvt->bridge_ck);if (pvt->bridge_ck ==NULL ) pvt->bridge_ck = pci_scan_single_device(pdev->bus,
@@ -1207,7 +1207,7 @@ static void e752x_init_error_reporting_regs(struct e752x_pvt *pvt) dev = pvt->dev_d0f1;/* Turn off error disable & SMI in case the BIOS turned it on */ -if (pvt->dev_info->err_dev ==PCI_DEVICE_ID_INTEL_3100_1_ERR ) { +if (pvt->edi->err_dev ==PCI_DEVICE_ID_INTEL_3100_1_ERR ) {pci_write_config_dword (dev,I3100_NSI_EMASK ,0 );pci_write_config_dword (dev,I3100_NSI_SMICMD ,0 ); }else {
@@ -1273,7 +1273,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)debugf3 ("%s(): init pvt\n" , __func__); pvt = (struct e752x_pvt *)mci->pvt_info; - pvt->dev_info = &e752x_devs[dev_idx]; + pvt->edi = &e752x_devs[dev_idx]; pvt->mc_symmetric = ((ddrcsr &0x10 ) !=0 );if (e752x_get_devs (pdev, dev_idx, pvt)) {
@@ -1282,7 +1282,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) }debugf3 ("%s(): more mci init\n" , __func__); - mci->ctl_name = pvt->dev_info->ctl_name; + mci->ctl_name = pvt->edi->ctl_name; mci->dev_name =pci_name (pdev); mci->edac_check = e752x_check; mci->ctl_page_to_phys = ctl_page_to_phys;
drivers/edac/e7xxx_edac.c +4 -4
@@ -128,7 +128,7 @@ struct e7xxx_pvt {u32 tolm;u32 remapbase;u32 remaplimit; -const struct e7xxx_dev_info *dev_info; +const struct e7xxx_dev_info *edi; };struct e7xxx_dev_info {
@@ -432,9 +432,9 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) mci->dev = &pdev->dev;debugf3 ("%s(): init pvt\n" , __func__); pvt = (struct e7xxx_pvt *)mci->pvt_info; - pvt->dev_info = &e7xxx_devs[dev_idx]; + pvt->edi = &e7xxx_devs[dev_idx]; pvt->bridge_ck =pci_get_device (PCI_VENDOR_ID_INTEL , - pvt->dev_info->err_dev, pvt->bridge_ck); + pvt->edi->err_dev, pvt->bridge_ck);if (!pvt->bridge_ck) { e7xxx_printk(KERN_ERR, "error reporting device not found:"
@@ -444,7 +444,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) }debugf3 ("%s(): more mci init\n" , __func__); - mci->ctl_name = pvt->dev_info->ctl_name; + mci->ctl_name = pvt->edi->ctl_name; mci->dev_name =pci_name (pdev); mci->edac_check = e7xxx_check; mci->ctl_page_to_phys = ctl_page_to_phys;
Signature · 9 lines
1.7.0.3.311.g6a6955 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
Re: [PATCH 07/11] drivers/edac/e7*_edac.c: Rename dev_info to edi
Quoted 11 lines · Joe Perches
From: Joe Perches <[email protected]>
Subject: [PATCH 07/11]drivers/edac/e7*_edac.c: Renamedev_infoto edi
To: "Andrew Morton" <[email protected]>
Cc: "Mark Gross" <[email protected]>, "Doug Thompson" <[email protected]>, [email protected], [email protected]
Date: Monday, April 5, 2010, 1:05 PM
There is a macro calleddev_infothat
prints struct device specific
information. Having variables with the same name can
be confusing and
prevents conversion of the macro to a function.
Quoted 5 lines
Rename the existing
dev_infovariables to something else in preparation
to converting thedev_infomacro to a function.Signed-off-by Joe Perches <[email protected]>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
PATCH 8/11 drivers/staging/iio: Rename dev_info to idi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/staging/iio/accel/lis3l02dq_core.c | 4 +- drivers/staging/iio/accel/lis3l02dq_ring.c | 20 ++-- drivers/staging/iio/accel/sca3000_core.c | 24 ++-- drivers/staging/iio/adc/max1363_core.c | 36 ++-- drivers/staging/iio/adc/max1363_ring.c | 6 +- drivers/staging/iio/chrdev.h | 2 +- drivers/staging/iio/iio.h | 54 ++++---- drivers/staging/iio/industrialio-core.c | 232 ++++++++++++++-------------- drivers/staging/iio/industrialio-ring.c | 38 +++--- drivers/staging/iio/industrialio-trigger.c | 34 ++-- drivers/staging/iio/ring_generic.h | 4 +- drivers/staging/iio/trigger_consumer.h | 16 +- 12 files changed, 235 insertions(+), 235 deletions(-)
drivers/staging/iio/accel/lis3l02dq_core.c +2 -2
@@ -596,12 +596,12 @@ error_mutex_unlock: } -static int lis3l02dq_thresh_handler_th (struct iio_dev *dev_info, +static int lis3l02dq_thresh_handler_th (struct iio_dev *idi,int index,s64 timestamp,int no_test) { -struct lis3l02dq_state *st = dev_info->dev_data; +struct lis3l02dq_state *st = idi->dev_data;/* Stash the timestamp somewhere convenient for the bh */ st->last_timestamp = timestamp;
drivers/staging/iio/accel/lis3l02dq_ring.c +10 -10
@@ -119,12 +119,12 @@ static void lis3l02dq_poll_func_th(struct iio_dev *indio_dev)/** * lis3l02dq_data_rdy_trig_poll() the event handler for the data rdy trig **/ -static int lis3l02dq_data_rdy_trig_poll (struct iio_dev *dev_info, +static int lis3l02dq_data_rdy_trig_poll (struct iio_dev *idi,int index,s64 timestamp,int no_test) { -struct lis3l02dq_state *st =iio_dev_get_devdata (dev_info); +struct lis3l02dq_state *st =iio_dev_get_devdata (idi);struct iio_trigger *trig = st->trig; trig->timestamp = timestamp;
@@ -146,31 +146,31 @@ ssize_t lis3l02dq_read_accel_from_ring(struct device *dev,struct iio_scan_el *el =NULL ;int ret, len =0 , i =0 ;struct iio_dev_attr *this_attr =to_iio_dev_attr (attr); -struct iio_dev *dev_info =dev_get_drvdata (dev); +struct iio_dev *idi =dev_get_drvdata (dev);s16 *data; -while (dev_info->scan_el_attrs->attrs[i]) { +while (idi->scan_el_attrs->attrs[i]) { el =to_iio_scan_el ((struct device_attribute *) - (dev_info->scan_el_attrs->attrs[i])); + (idi->scan_el_attrs->attrs[i]));/* label is in fact the address */ if (el->label == this_attr->address)break ; i++; } -if (!dev_info->scan_el_attrs->attrs[i]) { +if (!idi->scan_el_attrs->attrs[i]) { ret = -EINVAL ; goto error_ret; }/* If this element is in the scan mask */ - ret =iio_scan_mask_query (dev_info, el->number); + ret =iio_scan_mask_query (idi, el->number);if (ret <0 ) goto error_ret;if (ret) { - data =kmalloc (dev_info->ring->access.get_bpd (dev_info->ring), + data =kmalloc (idi->ring->access.get_bpd (idi->ring),GFP_KERNEL );if (data ==NULL )return -ENOMEM ; - ret = dev_info->ring->access.read_last (dev_info->ring, + ret = idi->ring->access.read_last (idi->ring, (u8 *)data);if (ret) goto error_free_data;
@@ -178,7 +178,7 @@ ssize_t lis3l02dq_read_accel_from_ring(struct device *dev, ret = -EINVAL ; goto error_ret; } - len =iio_scan_mask_count_to_right (dev_info, el->number); + len =iio_scan_mask_count_to_right (idi, el->number);if (len <0 ) { ret = len; goto error_free_data;
drivers/staging/iio/accel/sca3000_core.c +12 -12
@@ -331,8 +331,8 @@ static ssize_t sca3000_show_name(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); -struct sca3000_state *st = dev_info->dev_data; + struct iio_dev *idi = dev_get_drvdata(dev); +struct sca3000_state *st = idi->dev_data;return sprintf (buf,"%s\n" , st->info->name); }/**
@@ -343,8 +343,8 @@ static ssize_t sca3000_show_rev(struct device *dev, char *buf) {int len =0 , ret; -struct iio_dev *dev_info =dev_get_drvdata (dev); -struct sca3000_state *st = dev_info->dev_data; +struct iio_dev *idi =dev_get_drvdata (dev); +struct sca3000_state *st = idi->dev_data;u8 *rx;
@@ -375,8 +375,8 @@ sca3000_show_available_measurement_modes(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); -struct sca3000_state *st = dev_info->dev_data; + struct iio_dev *idi = dev_get_drvdata(dev); +struct sca3000_state *st = idi->dev_data;int len =0 ; len +=sprintf (buf + len,"0 - normal mode" );
@@ -407,8 +407,8 @@ sca3000_show_measurement_mode(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); -struct sca3000_state *st = dev_info->dev_data; + struct iio_dev *idi = dev_get_drvdata(dev); +struct sca3000_state *st = idi->dev_data;int len =0 , ret;u8 *rx;
@@ -459,8 +459,8 @@ sca3000_store_measurement_mode(struct device *dev, const char *buf, size_t len) { -struct iio_dev *dev_info =dev_get_drvdata (dev); -struct sca3000_state *st = dev_info->dev_data; +struct iio_dev *idi =dev_get_drvdata (dev); +struct sca3000_state *st = idi->dev_data;int ret;u8 *rx;int mask =0x03 ;
@@ -886,12 +886,12 @@ done:* These devices deploy unified interrupt status registers meaning * all interrupts must be handled together **/ -static int sca3000_handler_th (struct iio_dev *dev_info, +static int sca3000_handler_th (struct iio_dev *idi,int index,s64 timestamp,int no_test) { -struct sca3000_state *st = dev_info->dev_data; +struct sca3000_state *st = idi->dev_data; st->last_timestamp = timestamp;schedule_work (&st->interrupt_handler_ws);
drivers/staging/iio/adc/max1363_core.c +18 -18
@@ -321,8 +321,8 @@ static ssize_t max1363_show_av_scan_modes(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); -struct max1363_state *st = dev_info->dev_data; + struct iio_dev *idi = dev_get_drvdata(dev); +struct max1363_state *st = idi->dev_data;int i, len =0 ;for (i =0 ; i < st->chip_info->num_modes; i++)
@@ -340,8 +340,8 @@ static ssize_t max1363_scan_direct(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); -struct max1363_state *st = dev_info->dev_data; + struct iio_dev *idi = dev_get_drvdata(dev); +struct max1363_state *st = idi->dev_data;int len =0 , ret, i;struct i2c_client *client = st->client;char *rxbuf;
@@ -372,15 +372,15 @@ static ssize_t max1363_scan(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); + struct iio_dev *idi = dev_get_drvdata(dev);int ret; -mutex_lock (&dev_info->mlock); -if (dev_info->currentmode ==INDIO_RING_TRIGGERED ) +mutex_lock (&idi->mlock); +if (idi->currentmode ==INDIO_RING_TRIGGERED ) ret =max1363_scan_from_ring (dev, attr, buf);else ret =max1363_scan_direct (dev, attr, buf); -mutex_unlock (&dev_info->mlock); +mutex_unlock (&idi->mlock);return ret; }
@@ -390,8 +390,8 @@ static ssize_t max1363_show_scan_mode(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); -struct max1363_state *st = dev_info->dev_data; + struct iio_dev *idi = dev_get_drvdata(dev); +struct max1363_state *st = idi->dev_data;return sprintf (buf,"%s\n" , st->current_mode->name); }
@@ -413,15 +413,15 @@ static ssize_t max1363_store_scan_mode(struct device *dev, const char *buf, size_t len) { -struct iio_dev *dev_info =dev_get_drvdata (dev); -struct max1363_state *st = dev_info->dev_data; +struct iio_dev *idi =dev_get_drvdata (dev); +struct max1363_state *st = idi->dev_data;const struct max1363_mode *new_mode;int ret; -mutex_lock (&dev_info->mlock); +mutex_lock (&idi->mlock); new_mode =NULL ;/* Avoid state changes if a ring buffer is enabled */ -if (!iio_ring_enabled (dev_info)) { +if (!iio_ring_enabled (idi)) { new_mode =__max1363_find_mode_in_ci (st->chip_info, buf);if (!new_mode) {
@@ -436,12 +436,12 @@ static ssize_t max1363_store_scan_mode(struct device *dev, ret = -EBUSY ; goto error_ret; } -mutex_unlock (&dev_info->mlock); +mutex_unlock (&idi->mlock);return len; error_ret: -mutex_unlock (&dev_info->mlock); +mutex_unlock (&idi->mlock);return ret; }
@@ -457,8 +457,8 @@ static ssize_t max1363_show_name(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); -struct max1363_state *st = dev_info->dev_data; + struct iio_dev *idi = dev_get_drvdata(dev); +struct max1363_state *st = idi->dev_data;return sprintf (buf,"%s\n" , st->chip_info->name); }
drivers/staging/iio/adc/max1363_ring.c +3 -3
@@ -29,8 +29,8 @@ ssize_t max1363_scan_from_ring(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); -struct max1363_state *info = dev_info->dev_data; + struct iio_dev *idi = dev_get_drvdata(dev); +struct max1363_state *info = idi->dev_data;int i, ret, len =0 ;char *ring_data;
@@ -39,7 +39,7 @@ ssize_t max1363_scan_from_ring(struct device *dev, ret = -ENOMEM ; goto error_ret; } - ret = dev_info->ring->access.read_last (dev_info->ring, ring_data); + ret = idi->ring->access.read_last (idi->ring, ring_data);if (ret) goto error_free_ring_data; len +=sprintf (buf+len,"ring " );
drivers/staging/iio/chrdev.h +1 -1
@@ -113,7 +113,7 @@ struct iio_event_handler_list {struct list_head list;int refcount;struct mutex exist_lock; -int (*handler)(struct iio_dev *dev_info,int index,s64 timestamp, +int (*handler)(struct iio_dev *idi,int index,s64 timestamp,int no_test); };
drivers/staging/iio/iio.h +27 -27
149 lines not on this page · raw message
drivers/staging/iio/industrialio-core.c +116 -116
458 lines not on this page · raw message
drivers/staging/iio/industrialio-ring.c +19 -19
@@ -258,11 +258,11 @@ static void __iio_free_ring_buffer_access_chrdev(struct iio_ring_buffer *buf) }void iio_ring_buffer_init (struct iio_ring_buffer *ring, -struct iio_dev *dev_info) +struct iio_dev *idi) {if (ring->access.mark_param_change) ring->access.mark_param_change (ring); - ring->indio_dev = dev_info; + ring->indio_dev = idi; ring->ev_int.private = ring; ring->access_handler.private = ring; }
@@ -382,10 +382,10 @@ ssize_t iio_store_ring_enable(struct device *dev,bool requested_state, current_state;int previous_mode;struct iio_ring_buffer *ring =dev_get_drvdata (dev); -struct iio_dev *dev_info = ring->indio_dev; +struct iio_dev *idi = ring->indio_dev; -mutex_lock (&dev_info->mlock); - previous_mode = dev_info->currentmode; +mutex_lock (&idi->mlock); + previous_mode = idi->currentmode; requested_state = !(buf[0 ] =='0' ); current_state = !!(previous_mode &INDIO_ALL_RING_MODES );if (current_state == requested_state) {
@@ -394,7 +394,7 @@ ssize_t iio_store_ring_enable(struct device *dev, }if (requested_state) {if (ring->preenable) { - ret = ring->preenable (dev_info); + ret = ring->preenable (idi);if (ret) {printk (KERN_ERR "Buffer not started:"
@@ -414,8 +414,8 @@ ssize_t iio_store_ring_enable(struct device *dev,if (ring->access.mark_in_use) ring->access.mark_in_use (ring);/* Definitely possible for devices to support both of these.*/ -if (dev_info->modes &INDIO_RING_TRIGGERED ) { -if (!dev_info->trig) { +if (idi->modes &INDIO_RING_TRIGGERED ) { +if (!idi->trig) {printk (KERN_INFO "Buffer not started: no trigger\n" ); ret = -EINVAL ;
@@ -423,9 +423,9 @@ ssize_t iio_store_ring_enable(struct device *dev, ring->access.unmark_in_use (ring); goto error_ret; } - dev_info->currentmode =INDIO_RING_TRIGGERED ; - }else if (dev_info->modes &INDIO_RING_HARDWARE_BUFFER ) - dev_info->currentmode =INDIO_RING_HARDWARE_BUFFER ; + idi->currentmode =INDIO_RING_TRIGGERED ; + }else if (idi->modes &INDIO_RING_HARDWARE_BUFFER ) + idi->currentmode =INDIO_RING_HARDWARE_BUFFER ;else {/* should never be reached */ ret = -EINVAL ; goto error_ret;
@@ -433,40 +433,40 @@ ssize_t iio_store_ring_enable(struct device *dev,if (ring->postenable) { - ret = ring->postenable (dev_info); + ret = ring->postenable (idi);if (ret) {printk (KERN_INFO "Buffer not started:" "postenable failed\n" );if (ring->access.unmark_in_use) ring->access.unmark_in_use (ring); - dev_info->currentmode = previous_mode; + idi->currentmode = previous_mode;if (ring->postdisable) - ring->postdisable (dev_info); + ring->postdisable (idi); goto error_ret; } } }else {if (ring->predisable) { - ret = ring->predisable (dev_info); + ret = ring->predisable (idi);if (ret) goto error_ret; }if (ring->access.unmark_in_use) ring->access.unmark_in_use (ring); - dev_info->currentmode =INDIO_DIRECT_MODE ; + idi->currentmode =INDIO_DIRECT_MODE ;if (ring->postdisable) { - ret = ring->postdisable (dev_info); + ret = ring->postdisable (idi);if (ret) goto error_ret; } } done: -mutex_unlock (&dev_info->mlock); +mutex_unlock (&idi->mlock);return len; error_ret: -mutex_unlock (&dev_info->mlock); +mutex_unlock (&idi->mlock);return ret; }EXPORT_SYMBOL (iio_store_ring_enable);
drivers/staging/iio/industrialio-trigger.c +17 -17
@@ -288,13 +288,13 @@ static ssize_t iio_trigger_read_current(struct device *dev,struct device_attribute *attr, char *buf) { - struct iio_dev *dev_info = dev_get_drvdata(dev); + struct iio_dev *idi = dev_get_drvdata(dev);int len =0 ; -if (dev_info->trig) +if (idi->trig) len =snprintf (buf,IIO_TRIGGER_NAME_LENGTH ,"%s\n" , - dev_info->trig->name); + idi->trig->name);return len; }
@@ -310,22 +310,22 @@ static ssize_t iio_trigger_write_current(struct device *dev, const char *buf, size_t len) { -struct iio_dev *dev_info =dev_get_drvdata (dev); -struct iio_trigger *oldtrig = dev_info->trig; -mutex_lock (&dev_info->mlock); -if (dev_info->currentmode ==INDIO_RING_TRIGGERED ) { -mutex_unlock (&dev_info->mlock); +struct iio_dev *idi =dev_get_drvdata (dev); +struct iio_trigger *oldtrig = idi->trig; +mutex_lock (&idi->mlock); +if (idi->currentmode ==INDIO_RING_TRIGGERED ) { +mutex_unlock (&idi->mlock);return -EBUSY ; } -mutex_unlock (&dev_info->mlock); +mutex_unlock (&idi->mlock); len = len <IIO_TRIGGER_NAME_LENGTH ? len :IIO_TRIGGER_NAME_LENGTH ; - dev_info->trig =iio_trigger_find_by_name (buf, len); -if (oldtrig && dev_info->trig != oldtrig) + idi->trig =iio_trigger_find_by_name (buf, len); +if (oldtrig && idi->trig != oldtrig)iio_put_trigger (oldtrig); -if (dev_info->trig) -iio_get_trigger (dev_info->trig); +if (idi->trig) +iio_get_trigger (idi->trig);return len; }
@@ -380,18 +380,18 @@ void iio_free_trigger(struct iio_trigger *trig) }EXPORT_SYMBOL (iio_free_trigger); -int iio_device_register_trigger_consumer (struct iio_dev *dev_info) +int iio_device_register_trigger_consumer (struct iio_dev *idi) {int ret; - ret =sysfs_create_group (&dev_info->dev.kobj, + ret =sysfs_create_group (&idi->dev.kobj, &iio_trigger_consumer_attr_group);return ret; }EXPORT_SYMBOL (iio_device_register_trigger_consumer); -int iio_device_unregister_trigger_consumer (struct iio_dev *dev_info) +int iio_device_unregister_trigger_consumer (struct iio_dev *idi) { -sysfs_remove_group (&dev_info->dev.kobj, +sysfs_remove_group (&idi->dev.kobj, &iio_trigger_consumer_attr_group);return 0 ; }
drivers/staging/iio/ring_generic.h +2 -2
@@ -131,7 +131,7 @@ struct iio_ring_buffer { };void iio_ring_buffer_init (struct iio_ring_buffer *ring, -struct iio_dev *dev_info); +struct iio_dev *idi);/** * __iio_init_ring_buffer() - initialize common elements of ring buffers
@@ -166,7 +166,7 @@ struct iio_scan_el {unsigned int label;int (*set_state)(struct iio_scan_el *scanel, -struct iio_dev *dev_info, +struct iio_dev *idi,bool state); };
drivers/staging/iio/trigger_consumer.h +8 -8
@@ -11,32 +11,32 @@#ifdef CONFIG_IIO_TRIGGER /** * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers -* @dev_info: iio_dev associated with the device that will consume the trigger +* @idi: iio_dev associated with the device that will consume the trigger **/ -int iio_device_register_trigger_consumer (struct iio_dev *dev_info); +int iio_device_register_trigger_consumer (struct iio_dev *idi);/** * iio_device_unregister_trigger_consumer() - reverse the registration process -* @dev_info: iio_dev associated with the device that consumed the trigger +* @idi: iio_dev associated with the device that consumed the trigger **/ -int iio_device_unregister_trigger_consumer (struct iio_dev *dev_info); +int iio_device_unregister_trigger_consumer (struct iio_dev *idi);#else /** * iio_device_register_trigger_consumer() - set up an iio_dev to use triggers -* @dev_info: iio_dev associated with the device that will consume the trigger +* @idi: iio_dev associated with the device that will consume the trigger **/ -static int iio_device_register_trigger_consumer (struct iio_dev *dev_info) +static int iio_device_register_trigger_consumer (struct iio_dev *idi) {return 0 ; };/** * iio_device_unregister_trigger_consumer() - reverse the registration process -* @dev_info: iio_dev associated with the device that consumed the trigger +* @idi: iio_dev associated with the device that consumed the trigger **/ -static int iio_device_unregister_trigger_consumer (struct iio_dev *dev_info) +static int iio_device_unregister_trigger_consumer (struct iio_dev *idi) {return 0 ; };
Signature · 1 line
1.7.0.3.311.g6a6955
PATCH 9/11 pvrusb2-v4l2: Rename dev_info to pdi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
drivers/media/video/pvrusb2/pvrusb2-v4l2.c +11 -11
@@ -48,7 +48,7 @@ struct pvr2_v4l2_dev {struct pvr2_v4l2_fh {struct pvr2_channel channel; -struct pvr2_v4l2_dev *dev_info; +struct pvr2_v4l2_dev *pdi;enum v4l2_priority prio;struct pvr2_ioread *rhp;struct file *file;
@@ -161,7 +161,7 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) {struct pvr2_v4l2_fh *fh = file->private_data;struct pvr2_v4l2 *vp = fh->vhead; -struct pvr2_v4l2_dev *dev_info = fh->dev_info; +struct pvr2_v4l2_dev *pdi = fh->pdi;struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;long ret = -EINVAL ;
@@ -563,14 +563,14 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)case VIDIOC_STREAMON : { -if (!fh->dev_info->stream) { +if (!fh->pdi->stream) {/* No stream defined for this node. This means that we're not currently allowed to stream from this node. */ ret = -EPERM ;break ; } - ret =pvr2_hdw_set_stream_type (hdw,dev_info->config); + ret =pvr2_hdw_set_stream_type (hdw,pdi->config);if (ret <0 )return ret; ret =pvr2_hdw_set_streaming (hdw,!0 );break ;
@@ -578,7 +578,7 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)case VIDIOC_STREAMOFF : { -if (!fh->dev_info->stream) { +if (!fh->pdi->stream) {/* No stream defined for this node. This means that we're not currently allowed to stream from this node. */
@@ -1031,7 +1031,7 @@ static int pvr2_v4l2_open(struct file *file) }init_waitqueue_head (&fhp->wait_data); - fhp->dev_info = dip; + fhp->pdi = dip;pvr2_trace (PVR2_TRACE_STRUCT ,"Creating pvr_v4l2_fh id=%p" ,fhp);pvr2_channel_init (&fhp->channel,vp->channel.mc_head);
@@ -1112,7 +1112,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh)struct pvr2_hdw *hdw;if (fh->rhp)return 0 ; -if (!fh->dev_info->stream) { +if (!fh->pdi->stream) {/* No stream defined for this node. This means that we're not currently allowed to stream from this node. */ return -EPERM ;
@@ -1121,21 +1121,21 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh)/* First read() attempt. Try to claim the stream and start it... */ if ((ret =pvr2_channel_claim_stream (&fh->channel, - fh->dev_info->stream)) !=0 ) { + fh->pdi->stream)) !=0 ) {/* Someone else must already have it */ return ret; } - fh->rhp =pvr2_channel_create_mpeg_stream (fh->dev_info->stream); + fh->rhp =pvr2_channel_create_mpeg_stream (fh->pdi->stream);if (!fh->rhp) {pvr2_channel_claim_stream (&fh->channel,NULL );return -ENOMEM ; } hdw = fh->channel.mc_head->hdw; - sp = fh->dev_info->stream->stream; + sp = fh->pdi->stream->stream;pvr2_stream_set_callback (sp,(pvr2_stream_callback )pvr2_v4l2_notify,fh); -pvr2_hdw_set_stream_type (hdw,fh->dev_info->config); +pvr2_hdw_set_stream_type (hdw,fh->pdi->config);if ((ret =pvr2_hdw_set_streaming (hdw,!0 )) <0 )return ret;return pvr2_ioread_set_enabled (fh->rhp,!0 ); }
Signature · 1 line
1.7.0.3.311.g6a6955
Re: [PATCH 09/11] pvrusb2-v4l2: Rename dev_info to pdi
-Mike
Quoted 105 lines · Joe Perches
There is a macro called
dev_infothat prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.Rename the existing
dev_infovariables to something else in preparation to converting thedev_infomacro to a function.Signed-off-by Joe Perches <[email protected]>--- drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)drivers/media/video/pvrusb2/pvrusb2-v4l2.c +11
-11@@ -48,7 +48,7 @@ struct pvr2_v4l2_dev {struct pvr2_v4l2_fh {struct pvr2_channel channel; -struct pvr2_v4l2_dev *dev_info; +struct pvr2_v4l2_dev *pdi;enum v4l2_priority prio;struct pvr2_ioread *rhp;struct file *file;@@ -161,7 +161,7 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) {struct pvr2_v4l2_fh *fh = file->private_data;struct pvr2_v4l2 *vp = fh->vhead; -struct pvr2_v4l2_dev *dev_info = fh->dev_info; +struct pvr2_v4l2_dev *pdi = fh->pdi;struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;long ret = -EINVAL ;@@ -563,14 +563,14 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)case VIDIOC_STREAMON : { -if (!fh->dev_info->stream) { +if (!fh->pdi->stream) {/* No stream defined for this node. This means that we're not currently allowed to stream from this node. */ ret = -EPERM ;break ; } - ret =pvr2_hdw_set_stream_type (hdw,dev_info->config); + ret =pvr2_hdw_set_stream_type (hdw,pdi->config);if (ret <0 )return ret; ret =pvr2_hdw_set_streaming (hdw,!0 );break ;@@ -578,7 +578,7 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)case VIDIOC_STREAMOFF : { -if (!fh->dev_info->stream) { +if (!fh->pdi->stream) {/* No stream defined for this node. This means that we're not currently allowed to stream from this node. */ @@ -1031,7 +1031,7 @@ static int pvr2_v4l2_open(struct file *file) }init_waitqueue_head (&fhp->wait_data); - fhp->dev_info = dip; + fhp->pdi = dip;pvr2_trace (PVR2_TRACE_STRUCT ,"Creating pvr_v4l2_fh id=%p" ,fhp);pvr2_channel_init (&fhp->channel,vp->channel.mc_head);@@ -1112,7 +1112,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh)struct pvr2_hdw *hdw;if (fh->rhp)return 0 ; -if (!fh->dev_info->stream) { +if (!fh->pdi->stream) {/* No stream defined for this node. This means that we're not currently allowed to stream from this node. */ return -EPERM ;@@ -1121,21 +1121,21 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh)/* First read() attempt. Try to claim the stream and start it... */ if ((ret =pvr2_channel_claim_stream (&fh->channel, - fh->dev_info->stream)) !=0 ) { + fh->pdi->stream)) !=0 ) {/* Someone else must already have it */ return ret; } - fh->rhp =pvr2_channel_create_mpeg_stream (fh->dev_info->stream); + fh->rhp =pvr2_channel_create_mpeg_stream (fh->pdi->stream);if (!fh->rhp) {pvr2_channel_claim_stream (&fh->channel,NULL );return -ENOMEM ; } hdw = fh->channel.mc_head->hdw; - sp = fh->dev_info->stream->stream; + sp = fh->pdi->stream->stream;pvr2_stream_set_callback (sp,(pvr2_stream_callback )pvr2_v4l2_notify,fh); -pvr2_hdw_set_stream_type (hdw,fh->dev_info->config); +pvr2_hdw_set_stream_type (hdw,fh->pdi->config);if ((ret =pvr2_hdw_set_streaming (hdw,!0 )) <0 )return ret;return pvr2_ioread_set_enabled (fh->rhp,!0 ); }
Signature · 3 lines
Mike Isely isely @ isely (dot) net PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8
PATCH 10/11 drivers/char/mem.c: Rename dev_info to bdi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/char/mem.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/char/mem.c +3 -3
@@ -839,7 +839,7 @@ static const struct memdev {const char *name;mode_t mode;const struct file_operations *fops; -struct backing_dev_info *dev_info; +struct backing_dev_info *bdi; } devlist[] = { [1] = { "mem", 0, &mem_fops, &directly_mappable_cdev_bdi }, #ifdef CONFIG_DEVKMEM
@@ -873,8 +873,8 @@ static int memory_open(struct inode *inode, struct file *filp)return -ENXIO ; filp->f_op = dev->fops; -if (dev->dev_info) - filp->f_mapping->backing_dev_info = dev->dev_info; +if (dev->bdi) + filp->f_mapping->backing_dev_info = dev->bdi;if (dev->fops->open)return dev->fops->open (inode, filp);
Signature · 1 line
1.7.0.3.311.g6a6955
PATCH 11/11 drivers/uwb: Rename dev_info to wdi
In reply to Andrew MortonThere is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/uwb/i1480/i1480u-wlp/lc.c | 16 ++++++------ drivers/uwb/wlp/messages.c | 40 ++++++++++++++++---------------- drivers/uwb/wlp/sysfs.c | 46 ++++++++++++++++++------------------ drivers/uwb/wlp/wlp-lc.c | 12 +++++----- 4 files changed, 57 insertions(+), 57 deletions(-)
drivers/uwb/i1480/i1480u-wlp/lc.c +8 -8
@@ -92,28 +92,28 @@ void i1480u_init(struct i1480u *i1480u)* information elements have intuitive mappings, other not. */ static -void i1480u_fill_device_info (struct wlp *wlp,struct wlp_device_info *dev_info) +void i1480u_fill_device_info (struct wlp *wlp,struct wlp_device_info *wdi) { struct i1480u *i1480u = container_of(wlp, struct i1480u, wlp);struct usb_device *usb_dev = i1480u->usb_dev;/* Treat device name and model name the same */ if (usb_dev->descriptor.iProduct) {usb_string (usb_dev, usb_dev->descriptor.iProduct, - dev_info->name,sizeof (dev_info->name)); + wdi->name,sizeof (wdi->name));usb_string (usb_dev, usb_dev->descriptor.iProduct, - dev_info->model_name,sizeof (dev_info->model_name)); + wdi->model_name,sizeof (wdi->model_name)); }if (usb_dev->descriptor.iManufacturer)usb_string (usb_dev, usb_dev->descriptor.iManufacturer, - dev_info->manufacturer, -sizeof (dev_info->manufacturer)); -scnprintf (dev_info->model_nr,sizeof (dev_info->model_nr),"%04x" , + wdi->manufacturer, +sizeof (wdi->manufacturer)); +scnprintf (wdi->model_nr,sizeof (wdi->model_nr),"%04x" ,__le16_to_cpu (usb_dev->descriptor.bcdDevice));if (usb_dev->descriptor.iSerialNumber)usb_string (usb_dev, usb_dev->descriptor.iSerialNumber, - dev_info->serial,sizeof (dev_info->serial)); + wdi->serial,sizeof (wdi->serial));/* FIXME: where should we obtain category? */ - dev_info->prim_dev_type.category =cpu_to_le16 (WLP_DEV_CAT_OTHER ); + wdi->prim_dev_type.category =cpu_to_le16 (WLP_DEV_CAT_OTHER );/* FIXME: Complete OUI and OUIsubdiv attributes */ }
drivers/uwb/wlp/messages.c +20 -20
@@ -712,7 +712,7 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,struct sk_buff *_skb;void *d1_itr; -if (wlp->dev_info ==NULL ) { +if (wlp->wdi ==NULL ) { result =__wlp_setup_device_info (wlp);if (result <0 ) { dev_err(dev, "WLP: Unable to setup device "
@@ -720,7 +720,7 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss, goto error; } } - info = wlp->dev_info; + info = wlp->wdi; _skb =dev_alloc_skb (sizeof (*_d1) +sizeof (struct wlp_attr_uuid_e ) + sizeof(struct wlp_attr_wss_sel_mthd)
@@ -794,7 +794,7 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,void *d2_itr;size_t mem_needed; -if (wlp->dev_info ==NULL ) { +if (wlp->wdi ==NULL ) { result =__wlp_setup_device_info (wlp);if (result <0 ) { dev_err(dev, "WLP: Unable to setup device "
@@ -802,7 +802,7 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss, goto error; } } - info = wlp->dev_info; + info = wlp->wdi; mem_needed =sizeof (*_d2) +sizeof (struct wlp_attr_uuid_e ) +sizeof (struct wlp_attr_uuid_r )
@@ -970,7 +970,7 @@ error_parse:*/ static int wlp_get_variable_info (struct wlp *wlp,void *data, -struct wlp_device_info *dev_info,ssize_t len) +struct wlp_device_info *wdi,ssize_t len) {struct device *dev = &wlp->rc->uwb_dev.dev;size_t used =0 ;
@@ -993,7 +993,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_manufacturer (wlp, data + used, - dev_info->manufacturer, + wdi->manufacturer, len - used);if (result <0 ) { dev_err(dev, "WLP: Unable to obtain "
@@ -1011,7 +1011,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_model_name (wlp, data + used, - dev_info->model_name, + wdi->model_name, len - used);if (result <0 ) { dev_err(dev, "WLP: Unable to obtain Model "
@@ -1028,7 +1028,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_model_nr (wlp, data + used, - dev_info->model_nr, + wdi->model_nr, len - used);if (result <0 ) { dev_err(dev, "WLP: Unable to obtain Model "
@@ -1045,7 +1045,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_serial (wlp, data + used, - dev_info->serial, len - used); + wdi->serial, len - used);if (result <0 ) {dev_err (dev,"WLP: Unable to obtain Serial " "number attribute from D1 message.\n" );
@@ -1061,7 +1061,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_prim_dev_type (wlp, data + used, - &dev_info->prim_dev_type, + &wdi->prim_dev_type, len - used);if (result <0 ) { dev_err(dev, "WLP: Unable to obtain Primary "
@@ -1069,10 +1069,10 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, "message.\n"); goto error_parse; } - dev_info->prim_dev_type.category = -le16_to_cpu (dev_info->prim_dev_type.category); - dev_info->prim_dev_type.subID = -le16_to_cpu (dev_info->prim_dev_type.subID); + wdi->prim_dev_type.category = +le16_to_cpu (wdi->prim_dev_type.category); + wdi->prim_dev_type.subID = +le16_to_cpu (wdi->prim_dev_type.subID); last =WLP_ATTR_PRI_DEV_TYPE ; used += result;break ;
@@ -1098,7 +1098,7 @@ staticint wlp_parse_d1_frame (struct wlp *wlp,struct sk_buff *skb,struct wlp_uuid *uuid_e,enum wlp_wss_sel_mthd *sel_mthd, -struct wlp_device_info *dev_info, +struct wlp_device_info *wdi,enum wlp_assc_error *assc_err) {struct device *dev = &wlp->rc->uwb_dev.dev;
@@ -1123,7 +1123,7 @@ int wlp_parse_d1_frame(struct wlp *wlp, struct sk_buff *skb, goto error_parse; } used += result; - result =wlp_get_dev_name (wlp, ptr + used, dev_info->name, + result =wlp_get_dev_name (wlp, ptr + used, wdi->name, len - used);if (result <0 ) { dev_err(dev, "WLP: unable to obtain Device Name from D1 "
@@ -1131,7 +1131,7 @@ int wlp_parse_d1_frame(struct wlp *wlp, struct sk_buff *skb, goto error_parse; } used += result; - result =wlp_get_variable_info (wlp, ptr + used, dev_info, len - used); + result =wlp_get_variable_info (wlp, ptr + used, wdi, len - used);if (result <0 ) {dev_err (dev,"WLP: unable to obtain Device Information from " "D1 message.\n" );
@@ -1171,15 +1171,15 @@ void wlp_handle_d1_frame(struct work_struct *ws)struct device *dev = &wlp->rc->uwb_dev.dev;struct wlp_uuid uuid_e;enum wlp_wss_sel_mthd sel_mthd =0 ; -struct wlp_device_info dev_info; +struct wlp_device_info wdi;enum wlp_assc_error assc_err;struct sk_buff *resp =NULL ;/* Parse D1 frame */ mutex_lock (&wss->mutex);mutex_lock (&wlp->mutex);/* to access wlp->uuid */ -memset (&dev_info,0 ,sizeof (dev_info)); - result =wlp_parse_d1_frame (wlp, skb, &uuid_e, &sel_mthd, &dev_info, +memset (&wdi,0 ,sizeof (wdi)); + result =wlp_parse_d1_frame (wlp, skb, &uuid_e, &sel_mthd, &wdi, &assc_err);if (result <0 ) {dev_err (dev,"WLP: Unable to parse incoming D1 frame.\n" );
drivers/uwb/wlp/sysfs.c +23 -23
159 lines not on this page · raw message
drivers/uwb/wlp/wlp-lc.c +6 -6
@@ -39,9 +39,9 @@ void wlp_neighbor_init(struct wlp_neighbor_e *neighbor)int __wlp_alloc_device_info (struct wlp *wlp) {struct device *dev = &wlp->rc->uwb_dev.dev; -BUG_ON (wlp->dev_info !=NULL ); - wlp->dev_info =kzalloc (sizeof (struct wlp_device_info ),GFP_KERNEL ); -if (wlp->dev_info ==NULL ) { +BUG_ON (wlp->wdi !=NULL ); + wlp->wdi =kzalloc (sizeof (struct wlp_device_info ),GFP_KERNEL ); +if (wlp->wdi ==NULL ) {dev_err (dev,"WLP: Unable to allocate memory for " "device information.\n" );return -ENOMEM ;
@@ -58,7 +58,7 @@ int __wlp_alloc_device_info(struct wlp *wlp)static void __wlp_fill_device_info (struct wlp *wlp) { - wlp->fill_device_info (wlp, wlp->dev_info); + wlp->fill_device_info (wlp, wlp->wdi); }/**
@@ -538,8 +538,8 @@ void wlp_remove(struct wlp *wlp)uwb_notifs_deregister (wlp->rc, &wlp->uwb_notifs_handler);wlp_eda_release (&wlp->eda);mutex_lock (&wlp->mutex); -if (wlp->dev_info !=NULL ) -kfree (wlp->dev_info); +if (wlp->wdi !=NULL ) +kfree (wlp->wdi);mutex_unlock (&wlp->mutex); wlp->rc =NULL ; }
Signature · 1 line
1.7.0.3.311.g6a6955
Re: [PATCH 11/11] drivers/uwb: Rename dev_info to wdi
Quoted 6 lines · Joe Perches
There is a macro called
dev_infothat prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.Rename the existing
dev_infovariables to something else in preparation to converting thedev_infomacro to a function.
http://patchwork.ozlabs.org/patch/49421/
This marked as RFC in patchwork.
It's not intended to be.
David Miller
maintainerRe: [PATCH 11/11] drivers/uwb: Rename dev_info to wdi
From: Joe Perches <[email protected]>
Date: Mon, 05 Apr 2010 14:44:18 -0700
Quoted 5 lines · Joe Perches
Quoted 4 lines
There is a macro called
dev_infothat prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Quoted 7 lines
Quoted 2 lines
Rename the existing
dev_infovariables to something else in preparation to converting thedev_infomacro to a function.http://patchwork.ozlabs.org/patch/49421/
This marked as RFC in patchwork.
It's not intended to be.
Because I can't apply the entire set, I'd like someone else to take this in since it's not really a networking specific patch.
Re: [PATCH 11/11] drivers/uwb: Rename dev_info to wdi
Quoted 10 lines · David Miller
From: Joe Perches <[email protected]>
Date: Mon, 05 Apr 2010 14:44:18 -0700Quoted 7 lines · Joe Perches
Quoted 6 lines
There is a macro called
dev_infothat prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.Rename the existing
dev_infovariables to something else in preparation to converting thedev_infomacro to a function.
Quoted 8 lines
Quoted 4 lines
http://patchwork.ozlabs.org/patch/49421/
This marked as RFC in patchwork.
It's not intended to be.Because I can't apply the entire set, I'd like someone else to take this in since it's not really a networking specific patch.
I've taken it.
David
Signature · 6 lines
David Vrabel, Senior Software Engineer, Drivers CSR, Churchill House, Cambridge Business Park, Tel: +44 (0)1223 692562 Cowley Road, Cambridge, CB4 0WZ http://www.csr.com/ Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
PATCH v2 11/11 drivers/uwb: Rename dev_info to wdi
In reply to Joe PerchesNeglected to check-in the include file changed
There is a macro called dev_info that prints struct device specific information. Having variables with the same name can be confusing and prevents conversion of the macro to a function.
Rename the existing dev_info variables to something else in preparation to converting the dev_info macro to a function.
--- drivers/uwb/i1480/i1480u-wlp/lc.c | 16 ++++++------ drivers/uwb/wlp/messages.c | 40 ++++++++++++++++---------------- drivers/uwb/wlp/sysfs.c | 46 ++++++++++++++++++------------------ drivers/uwb/wlp/wlp-lc.c | 12 +++++----- include/linux/wlp.h | 2 +- 5 files changed, 58 insertions(+), 58 deletions(-)
drivers/uwb/i1480/i1480u-wlp/lc.c +8 -8
@@ -92,28 +92,28 @@ void i1480u_init(struct i1480u *i1480u)* information elements have intuitive mappings, other not. */ static -void i1480u_fill_device_info (struct wlp *wlp,struct wlp_device_info *dev_info) +void i1480u_fill_device_info (struct wlp *wlp,struct wlp_device_info *wdi) { struct i1480u *i1480u = container_of(wlp, struct i1480u, wlp);struct usb_device *usb_dev = i1480u->usb_dev;/* Treat device name and model name the same */ if (usb_dev->descriptor.iProduct) {usb_string (usb_dev, usb_dev->descriptor.iProduct, - dev_info->name,sizeof (dev_info->name)); + wdi->name,sizeof (wdi->name));usb_string (usb_dev, usb_dev->descriptor.iProduct, - dev_info->model_name,sizeof (dev_info->model_name)); + wdi->model_name,sizeof (wdi->model_name)); }if (usb_dev->descriptor.iManufacturer)usb_string (usb_dev, usb_dev->descriptor.iManufacturer, - dev_info->manufacturer, -sizeof (dev_info->manufacturer)); -scnprintf (dev_info->model_nr,sizeof (dev_info->model_nr),"%04x" , + wdi->manufacturer, +sizeof (wdi->manufacturer)); +scnprintf (wdi->model_nr,sizeof (wdi->model_nr),"%04x" ,__le16_to_cpu (usb_dev->descriptor.bcdDevice));if (usb_dev->descriptor.iSerialNumber)usb_string (usb_dev, usb_dev->descriptor.iSerialNumber, - dev_info->serial,sizeof (dev_info->serial)); + wdi->serial,sizeof (wdi->serial));/* FIXME: where should we obtain category? */ - dev_info->prim_dev_type.category =cpu_to_le16 (WLP_DEV_CAT_OTHER ); + wdi->prim_dev_type.category =cpu_to_le16 (WLP_DEV_CAT_OTHER );/* FIXME: Complete OUI and OUIsubdiv attributes */ }
drivers/uwb/wlp/messages.c +20 -20
@@ -712,7 +712,7 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss,struct sk_buff *_skb;void *d1_itr; -if (wlp->dev_info ==NULL ) { +if (wlp->wdi ==NULL ) { result =__wlp_setup_device_info (wlp);if (result <0 ) { dev_err(dev, "WLP: Unable to setup device "
@@ -720,7 +720,7 @@ static int wlp_build_assoc_d1(struct wlp *wlp, struct wlp_wss *wss, goto error; } } - info = wlp->dev_info; + info = wlp->wdi; _skb =dev_alloc_skb (sizeof (*_d1) +sizeof (struct wlp_attr_uuid_e ) + sizeof(struct wlp_attr_wss_sel_mthd)
@@ -794,7 +794,7 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss,void *d2_itr;size_t mem_needed; -if (wlp->dev_info ==NULL ) { +if (wlp->wdi ==NULL ) { result =__wlp_setup_device_info (wlp);if (result <0 ) { dev_err(dev, "WLP: Unable to setup device "
@@ -802,7 +802,7 @@ int wlp_build_assoc_d2(struct wlp *wlp, struct wlp_wss *wss, goto error; } } - info = wlp->dev_info; + info = wlp->wdi; mem_needed =sizeof (*_d2) +sizeof (struct wlp_attr_uuid_e ) +sizeof (struct wlp_attr_uuid_r )
@@ -970,7 +970,7 @@ error_parse:*/ static int wlp_get_variable_info (struct wlp *wlp,void *data, -struct wlp_device_info *dev_info,ssize_t len) +struct wlp_device_info *wdi,ssize_t len) {struct device *dev = &wlp->rc->uwb_dev.dev;size_t used =0 ;
@@ -993,7 +993,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_manufacturer (wlp, data + used, - dev_info->manufacturer, + wdi->manufacturer, len - used);if (result <0 ) { dev_err(dev, "WLP: Unable to obtain "
@@ -1011,7 +1011,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_model_name (wlp, data + used, - dev_info->model_name, + wdi->model_name, len - used);if (result <0 ) { dev_err(dev, "WLP: Unable to obtain Model "
@@ -1028,7 +1028,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_model_nr (wlp, data + used, - dev_info->model_nr, + wdi->model_nr, len - used);if (result <0 ) { dev_err(dev, "WLP: Unable to obtain Model "
@@ -1045,7 +1045,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_serial (wlp, data + used, - dev_info->serial, len - used); + wdi->serial, len - used);if (result <0 ) {dev_err (dev,"WLP: Unable to obtain Serial " "number attribute from D1 message.\n" );
@@ -1061,7 +1061,7 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, goto error_parse; } result =wlp_get_prim_dev_type (wlp, data + used, - &dev_info->prim_dev_type, + &wdi->prim_dev_type, len - used);if (result <0 ) { dev_err(dev, "WLP: Unable to obtain Primary "
@@ -1069,10 +1069,10 @@ int wlp_get_variable_info(struct wlp *wlp, void *data, "message.\n"); goto error_parse; } - dev_info->prim_dev_type.category = -le16_to_cpu (dev_info->prim_dev_type.category); - dev_info->prim_dev_type.subID = -le16_to_cpu (dev_info->prim_dev_type.subID); + wdi->prim_dev_type.category = +le16_to_cpu (wdi->prim_dev_type.category); + wdi->prim_dev_type.subID = +le16_to_cpu (wdi->prim_dev_type.subID); last =WLP_ATTR_PRI_DEV_TYPE ; used += result;break ;
@@ -1098,7 +1098,7 @@ staticint wlp_parse_d1_frame (struct wlp *wlp,struct sk_buff *skb,struct wlp_uuid *uuid_e,enum wlp_wss_sel_mthd *sel_mthd, -struct wlp_device_info *dev_info, +struct wlp_device_info *wdi,enum wlp_assc_error *assc_err) {struct device *dev = &wlp->rc->uwb_dev.dev;
@@ -1123,7 +1123,7 @@ int wlp_parse_d1_frame(struct wlp *wlp, struct sk_buff *skb, goto error_parse; } used += result; - result =wlp_get_dev_name (wlp, ptr + used, dev_info->name, + result =wlp_get_dev_name (wlp, ptr + used, wdi->name, len - used);if (result <0 ) { dev_err(dev, "WLP: unable to obtain Device Name from D1 "
@@ -1131,7 +1131,7 @@ int wlp_parse_d1_frame(struct wlp *wlp, struct sk_buff *skb, goto error_parse; } used += result; - result =wlp_get_variable_info (wlp, ptr + used, dev_info, len - used); + result =wlp_get_variable_info (wlp, ptr + used, wdi, len - used);if (result <0 ) {dev_err (dev,"WLP: unable to obtain Device Information from " "D1 message.\n" );
@@ -1171,15 +1171,15 @@ void wlp_handle_d1_frame(struct work_struct *ws)struct device *dev = &wlp->rc->uwb_dev.dev;struct wlp_uuid uuid_e;enum wlp_wss_sel_mthd sel_mthd =0 ; -struct wlp_device_info dev_info; +struct wlp_device_info wdi;enum wlp_assc_error assc_err;struct sk_buff *resp =NULL ;/* Parse D1 frame */ mutex_lock (&wss->mutex);mutex_lock (&wlp->mutex);/* to access wlp->uuid */ -memset (&dev_info,0 ,sizeof (dev_info)); - result =wlp_parse_d1_frame (wlp, skb, &uuid_e, &sel_mthd, &dev_info, +memset (&wdi,0 ,sizeof (wdi)); + result =wlp_parse_d1_frame (wlp, skb, &uuid_e, &sel_mthd, &wdi, &assc_err);if (result <0 ) {dev_err (dev,"WLP: Unable to parse incoming D1 frame.\n" );
drivers/uwb/wlp/sysfs.c +23 -23
159 lines not on this page · raw message
drivers/uwb/wlp/wlp-lc.c +6 -6
@@ -39,9 +39,9 @@ void wlp_neighbor_init(struct wlp_neighbor_e *neighbor)int __wlp_alloc_device_info (struct wlp *wlp) {struct device *dev = &wlp->rc->uwb_dev.dev; -BUG_ON (wlp->dev_info !=NULL ); - wlp->dev_info =kzalloc (sizeof (struct wlp_device_info ),GFP_KERNEL ); -if (wlp->dev_info ==NULL ) { +BUG_ON (wlp->wdi !=NULL ); + wlp->wdi =kzalloc (sizeof (struct wlp_device_info ),GFP_KERNEL ); +if (wlp->wdi ==NULL ) {dev_err (dev,"WLP: Unable to allocate memory for " "device information.\n" );return -ENOMEM ;
@@ -58,7 +58,7 @@ int __wlp_alloc_device_info(struct wlp *wlp)static void __wlp_fill_device_info (struct wlp *wlp) { - wlp->fill_device_info (wlp, wlp->dev_info); + wlp->fill_device_info (wlp, wlp->wdi); }/**
@@ -538,8 +538,8 @@ void wlp_remove(struct wlp *wlp)uwb_notifs_deregister (wlp->rc, &wlp->uwb_notifs_handler);wlp_eda_release (&wlp->eda);mutex_lock (&wlp->mutex); -if (wlp->dev_info !=NULL ) -kfree (wlp->dev_info); +if (wlp->wdi !=NULL ) +kfree (wlp->wdi);mutex_unlock (&wlp->mutex); wlp->rc =NULL ; }
include/linux/wlp.h +1 -1
@@ -655,7 +655,7 @@ struct wlp {struct mutex nbmutex;/* Neighbor mutex protects neighbors list */ struct list_head neighbors;/* Elements are wlp_neighbor_e */ struct uwb_notifs_handler uwb_notifs_handler; -struct wlp_device_info *dev_info; +struct wlp_device_info *wdi;void (*fill_device_info)(struct wlp *wlp,struct wlp_device_info *info);int (*xmit_frame)(struct wlp *,struct sk_buff *,struct uwb_dev_addr *);
PATCH v2 3/3 kernel.h kernel/printk.c: Convert pr_<level> macros to functions
In reply to Joe PerchesSave ~1K of duplicated KERN_<level> strings
Use %pV and struct va_format
Format arguments are verified before printk
--- include/linux/kernel.h | 70 +++++++++++++++++++++++++++++++++++++----------- kernel/printk.c | 26 ++++++++++++++++++ 2 files changed, 80 insertions(+), 16 deletions(-)
include/linux/kernel.h +54 -16
@@ -255,6 +255,22 @@ asmlinkage int vprintk(const char *fmt, va_list args) __attribute__ ((format (printf, 1, 0))); asmlinkage int printk(const char * fmt, ...) __attribute__ ((format (printf,1 ,2 )))__cold ; +asmlinkage int pr_emerg(const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +asmlinkage int pr_crit(const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +asmlinkage int pr_alert(const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +asmlinkage int pr_err(const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +asmlinkage int pr_warning(const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +asmlinkage int pr_notice(const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +asmlinkage int pr_info(const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +asmlinkage int pr_cont(const char *s, ...) + __attribute__ ((format (printf,1 ,2 )));extern int __printk_ratelimit (const char *func);#define printk_ratelimit () __printk_ratelimit(__func__)
@@ -283,6 +299,30 @@ static inline int vprintk(const char *s, va_list args) { return 0; }static inline int printk (const char *s, ...) __attribute__ ((format (printf,1 ,2 )));static inline int __cold printk (const char *s, ...) {return 0 ; } +static inline int pr_emerg (const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +static inline int pr_emerg (const char *s, ...) {return 0 ; } +static inline int pr_crit (const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +static inline int pr_crit (const char *s, ...) {return 0 ; } +static inline int pr_alert (const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +static inline int pr_alert (const char *s, ...) {return 0 ; } +static inline int pr_err (const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +static inline int pr_err (const char *s, ...) {return 0 ; } +static inline int pr_warning (const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +static inline int pr_warning (const char *s, ...) {return 0 ; } +static inline int pr_notice (const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +static inline int pr_notice (const char *s, ...) {return 0 ; } +static inline int pr_info (const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +static inline int pr_info (const char *s, ...) {return 0 ; } +static inline int pr_cont (const char *s, ...) + __attribute__ ((format (printf,1 ,2 ))); +static inline int pr_cont (const char *s, ...) {return 0 ; }static inline int printk_ratelimit (void ) {return 0 ; }static inline bool printk_timed_ratelimit (unsigned long *caller_jiffies, \unsigned int interval_msec) \
@@ -381,22 +421,20 @@ static inline char *pack_hex_byte(char *buf, u8 byte)#define pr_fmt (fmt) fmt#endif -#define pr_emerg (fmt, ...) \ - printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) -#define pr_alert (fmt, ...) \ - printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) -#define pr_crit (fmt, ...) \ - printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) -#define pr_err (fmt, ...) \ - printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) -#define pr_warning (fmt, ...) \ - printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) -#define pr_notice (fmt, ...) \ - printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) -#define pr_info (fmt, ...) \ - printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) -#define pr_cont (fmt, ...) \ - printk(KERN_CONT fmt, ##__VA_ARGS__) +#define pr_emerg (fmt, ...) \ + pr_emerg(pr_fmt(fmt), ##__VA_ARGS__) +#define pr_alert (fmt, ...) \ + pr_alert(pr_fmt(fmt), ##__VA_ARGS__) +#define pr_crit (fmt, ...) \ + pr_crit(pr_fmt(fmt), ##__VA_ARGS__) +#define pr_err (fmt, ...) \ + pr_err(pr_fmt(fmt), ##__VA_ARGS__) +#define pr_warning (fmt, ...) \ + pr_warning(pr_fmt(fmt), ##__VA_ARGS__) +#define pr_notice (fmt, ...) \ + pr_notice(pr_fmt(fmt), ##__VA_ARGS__) +#define pr_info (fmt, ...) \ + pr_info(pr_fmt(fmt), ##__VA_ARGS__)/* pr_devel() should produce zero code unless DEBUG is defined */ #ifdef DEBUG
kernel/printk.c +26 -0
@@ -797,6 +797,32 @@ out_restore_irqs:EXPORT_SYMBOL (printk);EXPORT_SYMBOL (vprintk); +#define declare_pr_level (function, level) \ +asmlinkage int function(const char *fmt, ...) \ +{ \ + struct va_format vaf; \ + va_list args; \ + int r; \ + \ + va_start(args, fmt); \ + vaf.fmt = fmt; \ + vaf.va = &args; \ + r = printk(level "%pV", &vaf); \ + va_end(args); \ + \ + return r; \ +} \ +EXPORT_SYMBOL(function) + +declare_pr_level (pr_emerg,KERN_EMERG ); +declare_pr_level (pr_alert,KERN_ALERT ); +declare_pr_level (pr_crit,KERN_CRIT ); +declare_pr_level (pr_err,KERN_ERR ); +declare_pr_level (pr_warning,KERN_WARNING ); +declare_pr_level (pr_notice,KERN_NOTICE ); +declare_pr_level (pr_info,KERN_INFO ); +declare_pr_level (pr_cont,KERN_CONT ); +#else static void call_console_drivers (unsigned start,unsigned end)
Signature · 1 line
1.7.0.14.g7e948