* [PATCH V2 0/3] recursive printk, make functions from logging macros
@ 2010-03-05 6:56 Joe Perches
2010-03-05 6:56 ` [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2010-03-05 6:56 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linus Torvalds, Greg Kroah-Hartman, linux-kernel, netdev
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(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions
2010-03-05 6:56 [PATCH V2 0/3] recursive printk, make functions from logging macros Joe Perches
@ 2010-03-05 6:56 ` Joe Perches
2010-03-05 7:10 ` Andrew Morton
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2010-03-05 6:56 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linus Torvalds, Greg Kroah-Hartman, linux-kernel, netdev
Save ~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.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/base/core.c | 56 +++++++++++++++++++++++++
include/linux/device.h | 105 ++++++++++++++++++++++++++++++++++++------------
2 files changed, 135 insertions(+), 26 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 2820257..19de3ab 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -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
diff --git a/include/linux/device.h b/include/linux/device.h
index b30527d..5948c07 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -590,43 +590,96 @@ extern void sysdev_shutdown(void);
/* debugging and troubleshooting/diagnostic helpers. */
extern const char *dev_driver_string(const struct device *dev);
-#define dev_printk(level, dev, format, arg...) \
- printk(level "%s %s: " format , dev_driver_string(dev) , \
- dev_name(dev) , ## arg)
-
-#define dev_emerg(dev, format, arg...) \
- dev_printk(KERN_EMERG , dev , format , ## arg)
-#define dev_alert(dev, format, arg...) \
- dev_printk(KERN_ALERT , dev , format , ## arg)
-#define dev_crit(dev, format, arg...) \
- dev_printk(KERN_CRIT , dev , format , ## arg)
-#define dev_err(dev, format, arg...) \
- dev_printk(KERN_ERR , dev , format , ## arg)
-#define dev_warn(dev, format, arg...) \
- dev_printk(KERN_WARNING , dev , format , ## arg)
-#define dev_notice(dev, format, arg...) \
- dev_printk(KERN_NOTICE , dev , format , ## arg)
-#define dev_info(dev, format, arg...) \
- dev_printk(KERN_INFO , dev , format , ## arg)
+
+#ifdef CONFIG_PRINTK
+
+extern int dev_printk(const char *level, const struct device *dev,
+ const char *fmt, ...)
+ __attribute__ ((format (printf, 3, 4)));
+extern int dev_emerg(const struct device *dev, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+extern int dev_alert(const struct device *dev, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+extern int dev_crit(const struct device *dev, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+extern int dev_err(const struct device *dev, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+extern int dev_warn(const struct device *dev, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+extern int dev_notice(const struct device *dev, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+extern int _dev_info(const struct device *dev, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+
+#else
+
+static inline int dev_printk(const char *level, const struct device *dev,
+ const char *fmt, ...)
+ __attribute__ ((format (printf, 3, 4)));
+static inline int dev_printk(const char *level, const struct device *dev,
+ const char *fmt, ...)
+ { return 0; }
+
+static inline int dev_emerg(const struct device *dev, const char *s, ...)
+ __attribute__ ((format (printf, 2, 3)));
+static inline int dev_emerg(const struct device *dev, const char *s, ...)
+ { return 0; }
+static inline int dev_crit(const struct device *dev, const char *s, ...)
+ __attribute__ ((format (printf, 2, 3)));
+static inline int dev_crit(const struct device *dev, const char *s, ...)
+ { return 0; }
+static inline int dev_alert(const struct device *dev, const char *s, ...)
+ __attribute__ ((format (printf, 2, 3)));
+static inline int dev_alert(const struct device *dev, const char *s, ...)
+ { return 0; }
+static inline int dev_err(const struct device *dev, const char *s, ...)
+ __attribute__ ((format (printf, 2, 3)));
+static inline int dev_err(const struct device *dev, const char *s, ...)
+ { return 0; }
+static inline int dev_warn(const struct device *dev, const char *s, ...)
+ __attribute__ ((format (printf, 2, 3)));
+static inline int dev_warn(const struct device *dev, const char *s, ...)
+ { return 0; }
+static inline int dev_notice(const struct device *dev, const char *s, ...)
+ __attribute__ ((format (printf, 2, 3)));
+static inline int dev_notice(const struct device *dev, const char *s, ...)
+ { return 0; }
+static inline int _dev_info(const struct device *dev, const char *s, ...)
+ __attribute__ ((format (printf, 2, 3)));
+static inline int _dev_info(const struct device *dev, const char *s, ...)
+ { return 0; }
+
+#endif
+
+#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
+/* workaround for existing struct dev_info and variable dev_info uses */
#if defined(DEBUG)
#define dev_dbg(dev, format, arg...) \
- dev_printk(KERN_DEBUG , dev , format , ## arg)
+ dev_printk(KERN_DEBUG, dev, format, ##arg)
#elif defined(CONFIG_DYNAMIC_DEBUG)
-#define dev_dbg(dev, format, ...) do { \
+#define dev_dbg(dev, format, ...) \
+do { \
dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
- } while (0)
+} while (0)
#else
-#define dev_dbg(dev, format, arg...) \
- ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
+#define dev_dbg(dev, format, arg...) \
+({ \
+ if (0) \
+ dev_printk(KERN_DEBUG, dev, format, ##arg); \
+ 0; \
+})
#endif
#ifdef VERBOSE_DEBUG
#define dev_vdbg dev_dbg
#else
-
-#define dev_vdbg(dev, format, arg...) \
- ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
+#define dev_vdbg(dev, format, arg...) \
+({ \
+ if (0) \
+ dev_printk(KERN_DEBUG, dev, format, ##arg); \
+ 0; \
+})
#endif
/*
--
1.7.0.14.g7e948
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions
2010-03-05 6:56 ` [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions Joe Perches
@ 2010-03-05 7:10 ` Andrew Morton
2010-03-05 7:23 ` Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2010-03-05 7:10 UTC (permalink / raw)
To: Joe Perches; +Cc: Linus Torvalds, Greg Kroah-Hartman, linux-kernel, netdev
On Thu, 4 Mar 2010 22:56:53 -0800 Joe Perches <joe@perches.com> wrote:
> Perhaps over time the struct and local uses of dev_info should be renamed.
aww, c'mon.
y:/usr/src/linux-2.6.33> grep -r '\*dev_info;' . | wc -l
30
Half an hour, tops.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions
2010-03-05 7:10 ` Andrew Morton
@ 2010-03-05 7:23 ` Joe Perches
2010-03-05 7:29 ` Andrew Morton
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2010-03-05 7:23 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linus Torvalds, Greg Kroah-Hartman, linux-kernel, netdev
On Thu, 2010-03-04 at 23:10 -0800, Andrew Morton wrote:
> On Thu, 4 Mar 2010 22:56:53 -0800 Joe Perches <joe@perches.com> wrote:
> > Perhaps over time the struct and local uses of dev_info should 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions
2010-03-05 7:23 ` Joe Perches
@ 2010-03-05 7:29 ` Andrew Morton
[not found] ` <20100304232928.2e45bdd1.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2010-03-05 7:29 UTC (permalink / raw)
To: Joe Perches; +Cc: Linus Torvalds, Greg Kroah-Hartman, linux-kernel, netdev
On Thu, 04 Mar 2010 23:23:35 -0800 Joe Perches <joe@perches.com> wrote:
> On Thu, 2010-03-04 at 23:10 -0800, Andrew Morton wrote:
> > On Thu, 4 Mar 2010 22:56:53 -0800 Joe Perches <joe@perches.com> wrote:
> > > Perhaps over time the struct and local uses of dev_info should 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".
Well, that has to be one of the worst possible reasons?
> $ 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
Send 'em over, please. I'll merge any stragglers directly.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 00/11] treewide: rename dev_info variables to something else
[not found] ` <20100304232928.2e45bdd1.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
@ 2010-04-05 19:05 ` Joe Perches
2010-04-05 19:05 ` [PATCH 11/11] drivers/uwb: Rename dev_info to wdi Joe Perches
0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2010-04-05 19:05 UTC (permalink / raw)
To: Andrew Morton
Cc: Tony Luck, Fenghua Yu, Mark Gross, Doug Thompson, Mike Isely,
Mauro Carvalho Chehab, Martin Schwidefsky, Heiko Carstens,
linux390-tA70FqPdS9bQT0dZR+AlfA, Greg Kroah-Hartman, David Vrabel,
linux-ia64-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
bluesmoke-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-media-u79uwXL29TY76Z2rM5mHXA,
linux-s390-u79uwXL29TY76Z2rM5mHXA,
devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 11/11] drivers/uwb: Rename dev_info to wdi
2010-04-05 19:05 ` [PATCH 00/11] treewide: rename dev_info variables to something else Joe Perches
@ 2010-04-05 19:05 ` Joe Perches
2010-04-05 21:44 ` Joe Perches
2010-04-05 22:24 ` [PATCH 11/11 v2] " Joe Perches
0 siblings, 2 replies; 11+ messages in thread
From: Joe Perches @ 2010-04-05 19:05 UTC (permalink / raw)
To: Andrew Morton; +Cc: David Vrabel, netdev, linux-kernel
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.
Signed-off-by: Joe Perches <joe@perches.com>
---
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(-)
diff --git a/drivers/uwb/i1480/i1480u-wlp/lc.c b/drivers/uwb/i1480/i1480u-wlp/lc.c
index f272dfe..bd52675 100644
--- a/drivers/uwb/i1480/i1480u-wlp/lc.c
+++ b/drivers/uwb/i1480/i1480u-wlp/lc.c
@@ -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 */
}
diff --git a/drivers/uwb/wlp/messages.c b/drivers/uwb/wlp/messages.c
index 7516486..4057942 100644
--- a/drivers/uwb/wlp/messages.c
+++ b/drivers/uwb/wlp/messages.c
@@ -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 @@ static
int 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");
diff --git a/drivers/uwb/wlp/sysfs.c b/drivers/uwb/wlp/sysfs.c
index 6627c94..b24751c 100644
--- a/drivers/uwb/wlp/sysfs.c
+++ b/drivers/uwb/wlp/sysfs.c
@@ -333,12 +333,12 @@ ssize_t wlp_dev_##type##_show(struct wlp *wlp, char *buf) \
{ \
ssize_t result = 0; \
mutex_lock(&wlp->mutex); \
- if (wlp->dev_info == NULL) { \
+ if (wlp->wdi == NULL) { \
result = __wlp_setup_device_info(wlp); \
if (result < 0) \
goto out; \
} \
- result = scnprintf(buf, PAGE_SIZE, "%s\n", wlp->dev_info->type);\
+ result = scnprintf(buf, PAGE_SIZE, "%s\n", wlp->wdi->type); \
out: \
mutex_unlock(&wlp->mutex); \
return result; \
@@ -360,14 +360,14 @@ ssize_t wlp_dev_##type##_store(struct wlp *wlp, const char *buf, size_t size)\
ssize_t result; \
char format[10]; \
mutex_lock(&wlp->mutex); \
- if (wlp->dev_info == NULL) { \
+ if (wlp->wdi == NULL) { \
result = __wlp_alloc_device_info(wlp); \
if (result < 0) \
goto out; \
} \
- memset(wlp->dev_info->type, 0, sizeof(wlp->dev_info->type)); \
+ memset(wlp->wdi->type, 0, sizeof(wlp->wdi->type)); \
sprintf(format, "%%%uc", len); \
- result = sscanf(buf, format, wlp->dev_info->type); \
+ result = sscanf(buf, format, wlp->wdi->type); \
out: \
mutex_unlock(&wlp->mutex); \
return result < 0 ? result : size; \
@@ -409,13 +409,13 @@ ssize_t wlp_dev_prim_category_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%s\n",
- wlp_dev_category_str(wlp->dev_info->prim_dev_type.category));
+ wlp_dev_category_str(wlp->wdi->prim_dev_type.category));
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -428,7 +428,7 @@ ssize_t wlp_dev_prim_category_store(struct wlp *wlp, const char *buf,
ssize_t result;
u16 cat;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
@@ -436,7 +436,7 @@ ssize_t wlp_dev_prim_category_store(struct wlp *wlp, const char *buf,
result = sscanf(buf, "%hu", &cat);
if ((cat >= WLP_DEV_CAT_COMPUTER && cat <= WLP_DEV_CAT_TELEPHONE)
|| cat == WLP_DEV_CAT_OTHER)
- wlp->dev_info->prim_dev_type.category = cat;
+ wlp->wdi->prim_dev_type.category = cat;
else
result = -EINVAL;
out:
@@ -449,15 +449,15 @@ ssize_t wlp_dev_prim_OUI_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%02x:%02x:%02x\n",
- wlp->dev_info->prim_dev_type.OUI[0],
- wlp->dev_info->prim_dev_type.OUI[1],
- wlp->dev_info->prim_dev_type.OUI[2]);
+ wlp->wdi->prim_dev_type.OUI[0],
+ wlp->wdi->prim_dev_type.OUI[1],
+ wlp->wdi->prim_dev_type.OUI[2]);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -469,7 +469,7 @@ ssize_t wlp_dev_prim_OUI_store(struct wlp *wlp, const char *buf, size_t size)
ssize_t result;
u8 OUI[3];
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
@@ -480,7 +480,7 @@ ssize_t wlp_dev_prim_OUI_store(struct wlp *wlp, const char *buf, size_t size)
result = -EINVAL;
goto out;
} else
- memcpy(wlp->dev_info->prim_dev_type.OUI, OUI, sizeof(OUI));
+ memcpy(wlp->wdi->prim_dev_type.OUI, OUI, sizeof(OUI));
out:
mutex_unlock(&wlp->mutex);
return result < 0 ? result : size;
@@ -492,13 +492,13 @@ ssize_t wlp_dev_prim_OUI_sub_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%u\n",
- wlp->dev_info->prim_dev_type.OUIsubdiv);
+ wlp->wdi->prim_dev_type.OUIsubdiv);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -512,14 +512,14 @@ ssize_t wlp_dev_prim_OUI_sub_store(struct wlp *wlp, const char *buf,
unsigned sub;
u8 max_sub = ~0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
}
result = sscanf(buf, "%u", &sub);
if (sub <= max_sub)
- wlp->dev_info->prim_dev_type.OUIsubdiv = sub;
+ wlp->wdi->prim_dev_type.OUIsubdiv = sub;
else
result = -EINVAL;
out:
@@ -532,13 +532,13 @@ ssize_t wlp_dev_prim_subcat_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%u\n",
- wlp->dev_info->prim_dev_type.subID);
+ wlp->wdi->prim_dev_type.subID);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -552,14 +552,14 @@ ssize_t wlp_dev_prim_subcat_store(struct wlp *wlp, const char *buf,
unsigned sub;
__le16 max_sub = ~0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
}
result = sscanf(buf, "%u", &sub);
if (sub <= max_sub)
- wlp->dev_info->prim_dev_type.subID = sub;
+ wlp->wdi->prim_dev_type.subID = sub;
else
result = -EINVAL;
out:
diff --git a/drivers/uwb/wlp/wlp-lc.c b/drivers/uwb/wlp/wlp-lc.c
index 13db739..530613e 100644
--- a/drivers/uwb/wlp/wlp-lc.c
+++ b/drivers/uwb/wlp/wlp-lc.c
@@ -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;
}
--
1.7.0.3.311.g6a6955
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 11/11] drivers/uwb: Rename dev_info to wdi
2010-04-05 19:05 ` [PATCH 11/11] drivers/uwb: Rename dev_info to wdi Joe Perches
@ 2010-04-05 21:44 ` Joe Perches
2010-04-05 21:51 ` David Miller
2010-04-05 22:24 ` [PATCH 11/11 v2] " Joe Perches
1 sibling, 1 reply; 11+ messages in thread
From: Joe Perches @ 2010-04-05 21:44 UTC (permalink / raw)
To: Andrew Morton, David Miller; +Cc: David Vrabel, netdev, linux-kernel
On Mon, 2010-04-05 at 12:05 -0700, Joe Perches wrote:
> 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.
http://patchwork.ozlabs.org/patch/49421/
This marked as RFC in patchwork.
It's not intended to be.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 11/11] drivers/uwb: Rename dev_info to wdi
2010-04-05 21:44 ` Joe Perches
@ 2010-04-05 21:51 ` David Miller
2010-04-06 12:42 ` David Vrabel
0 siblings, 1 reply; 11+ messages in thread
From: David Miller @ 2010-04-05 21:51 UTC (permalink / raw)
To: joe; +Cc: akpm, david.vrabel, netdev, linux-kernel
From: Joe Perches <joe@perches.com>
Date: Mon, 05 Apr 2010 14:44:18 -0700
> On Mon, 2010-04-05 at 12:05 -0700, Joe Perches wrote:
>> 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.
>
> 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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 11/11 v2] drivers/uwb: Rename dev_info to wdi
2010-04-05 19:05 ` [PATCH 11/11] drivers/uwb: Rename dev_info to wdi Joe Perches
2010-04-05 21:44 ` Joe Perches
@ 2010-04-05 22:24 ` Joe Perches
1 sibling, 0 replies; 11+ messages in thread
From: Joe Perches @ 2010-04-05 22:24 UTC (permalink / raw)
To: Andrew Morton; +Cc: David Vrabel, netdev, linux-kernel
Neglected 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.
Signed-off-by: Joe Perches <joe@perches.com>
---
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(-)
diff --git a/drivers/uwb/i1480/i1480u-wlp/lc.c b/drivers/uwb/i1480/i1480u-wlp/lc.c
index f272dfe..bd52675 100644
--- a/drivers/uwb/i1480/i1480u-wlp/lc.c
+++ b/drivers/uwb/i1480/i1480u-wlp/lc.c
@@ -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 */
}
diff --git a/drivers/uwb/wlp/messages.c b/drivers/uwb/wlp/messages.c
index 7516486..4057942 100644
--- a/drivers/uwb/wlp/messages.c
+++ b/drivers/uwb/wlp/messages.c
@@ -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 @@ static
int 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");
diff --git a/drivers/uwb/wlp/sysfs.c b/drivers/uwb/wlp/sysfs.c
index 6627c94..b24751c 100644
--- a/drivers/uwb/wlp/sysfs.c
+++ b/drivers/uwb/wlp/sysfs.c
@@ -333,12 +333,12 @@ ssize_t wlp_dev_##type##_show(struct wlp *wlp, char *buf) \
{ \
ssize_t result = 0; \
mutex_lock(&wlp->mutex); \
- if (wlp->dev_info == NULL) { \
+ if (wlp->wdi == NULL) { \
result = __wlp_setup_device_info(wlp); \
if (result < 0) \
goto out; \
} \
- result = scnprintf(buf, PAGE_SIZE, "%s\n", wlp->dev_info->type);\
+ result = scnprintf(buf, PAGE_SIZE, "%s\n", wlp->wdi->type); \
out: \
mutex_unlock(&wlp->mutex); \
return result; \
@@ -360,14 +360,14 @@ ssize_t wlp_dev_##type##_store(struct wlp *wlp, const char *buf, size_t size)\
ssize_t result; \
char format[10]; \
mutex_lock(&wlp->mutex); \
- if (wlp->dev_info == NULL) { \
+ if (wlp->wdi == NULL) { \
result = __wlp_alloc_device_info(wlp); \
if (result < 0) \
goto out; \
} \
- memset(wlp->dev_info->type, 0, sizeof(wlp->dev_info->type)); \
+ memset(wlp->wdi->type, 0, sizeof(wlp->wdi->type)); \
sprintf(format, "%%%uc", len); \
- result = sscanf(buf, format, wlp->dev_info->type); \
+ result = sscanf(buf, format, wlp->wdi->type); \
out: \
mutex_unlock(&wlp->mutex); \
return result < 0 ? result : size; \
@@ -409,13 +409,13 @@ ssize_t wlp_dev_prim_category_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%s\n",
- wlp_dev_category_str(wlp->dev_info->prim_dev_type.category));
+ wlp_dev_category_str(wlp->wdi->prim_dev_type.category));
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -428,7 +428,7 @@ ssize_t wlp_dev_prim_category_store(struct wlp *wlp, const char *buf,
ssize_t result;
u16 cat;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
@@ -436,7 +436,7 @@ ssize_t wlp_dev_prim_category_store(struct wlp *wlp, const char *buf,
result = sscanf(buf, "%hu", &cat);
if ((cat >= WLP_DEV_CAT_COMPUTER && cat <= WLP_DEV_CAT_TELEPHONE)
|| cat == WLP_DEV_CAT_OTHER)
- wlp->dev_info->prim_dev_type.category = cat;
+ wlp->wdi->prim_dev_type.category = cat;
else
result = -EINVAL;
out:
@@ -449,15 +449,15 @@ ssize_t wlp_dev_prim_OUI_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%02x:%02x:%02x\n",
- wlp->dev_info->prim_dev_type.OUI[0],
- wlp->dev_info->prim_dev_type.OUI[1],
- wlp->dev_info->prim_dev_type.OUI[2]);
+ wlp->wdi->prim_dev_type.OUI[0],
+ wlp->wdi->prim_dev_type.OUI[1],
+ wlp->wdi->prim_dev_type.OUI[2]);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -469,7 +469,7 @@ ssize_t wlp_dev_prim_OUI_store(struct wlp *wlp, const char *buf, size_t size)
ssize_t result;
u8 OUI[3];
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
@@ -480,7 +480,7 @@ ssize_t wlp_dev_prim_OUI_store(struct wlp *wlp, const char *buf, size_t size)
result = -EINVAL;
goto out;
} else
- memcpy(wlp->dev_info->prim_dev_type.OUI, OUI, sizeof(OUI));
+ memcpy(wlp->wdi->prim_dev_type.OUI, OUI, sizeof(OUI));
out:
mutex_unlock(&wlp->mutex);
return result < 0 ? result : size;
@@ -492,13 +492,13 @@ ssize_t wlp_dev_prim_OUI_sub_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%u\n",
- wlp->dev_info->prim_dev_type.OUIsubdiv);
+ wlp->wdi->prim_dev_type.OUIsubdiv);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -512,14 +512,14 @@ ssize_t wlp_dev_prim_OUI_sub_store(struct wlp *wlp, const char *buf,
unsigned sub;
u8 max_sub = ~0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
}
result = sscanf(buf, "%u", &sub);
if (sub <= max_sub)
- wlp->dev_info->prim_dev_type.OUIsubdiv = sub;
+ wlp->wdi->prim_dev_type.OUIsubdiv = sub;
else
result = -EINVAL;
out:
@@ -532,13 +532,13 @@ ssize_t wlp_dev_prim_subcat_show(struct wlp *wlp, char *buf)
{
ssize_t result = 0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_setup_device_info(wlp);
if (result < 0)
goto out;
}
result = scnprintf(buf, PAGE_SIZE, "%u\n",
- wlp->dev_info->prim_dev_type.subID);
+ wlp->wdi->prim_dev_type.subID);
out:
mutex_unlock(&wlp->mutex);
return result;
@@ -552,14 +552,14 @@ ssize_t wlp_dev_prim_subcat_store(struct wlp *wlp, const char *buf,
unsigned sub;
__le16 max_sub = ~0;
mutex_lock(&wlp->mutex);
- if (wlp->dev_info == NULL) {
+ if (wlp->wdi == NULL) {
result = __wlp_alloc_device_info(wlp);
if (result < 0)
goto out;
}
result = sscanf(buf, "%u", &sub);
if (sub <= max_sub)
- wlp->dev_info->prim_dev_type.subID = sub;
+ wlp->wdi->prim_dev_type.subID = sub;
else
result = -EINVAL;
out:
diff --git a/drivers/uwb/wlp/wlp-lc.c b/drivers/uwb/wlp/wlp-lc.c
index 13db739..530613e 100644
--- a/drivers/uwb/wlp/wlp-lc.c
+++ b/drivers/uwb/wlp/wlp-lc.c
@@ -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;
}
diff --git a/include/linux/wlp.h b/include/linux/wlp.h
index ac95ce6..e8e3ff2 100644
--- a/include/linux/wlp.h
+++ b/include/linux/wlp.h
@@ -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 *);
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 11/11] drivers/uwb: Rename dev_info to wdi
2010-04-05 21:51 ` David Miller
@ 2010-04-06 12:42 ` David Vrabel
0 siblings, 0 replies; 11+ messages in thread
From: David Vrabel @ 2010-04-06 12:42 UTC (permalink / raw)
To: David Miller; +Cc: joe, akpm, netdev, linux-kernel
David Miller wrote:
> From: Joe Perches <joe@perches.com>
> Date: Mon, 05 Apr 2010 14:44:18 -0700
>
>> On Mon, 2010-04-05 at 12:05 -0700, Joe Perches wrote:
>>> 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.
>> 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
--
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
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-04-06 12:46 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-05 6:56 [PATCH V2 0/3] recursive printk, make functions from logging macros Joe Perches
2010-03-05 6:56 ` [PATCH 2/3] device.h drivers/base/core.c Convert dev_<level> macros to functions Joe Perches
2010-03-05 7:10 ` Andrew Morton
2010-03-05 7:23 ` Joe Perches
2010-03-05 7:29 ` Andrew Morton
[not found] ` <20100304232928.2e45bdd1.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2010-04-05 19:05 ` [PATCH 00/11] treewide: rename dev_info variables to something else Joe Perches
2010-04-05 19:05 ` [PATCH 11/11] drivers/uwb: Rename dev_info to wdi Joe Perches
2010-04-05 21:44 ` Joe Perches
2010-04-05 21:51 ` David Miller
2010-04-06 12:42 ` David Vrabel
2010-04-05 22:24 ` [PATCH 11/11 v2] " Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).