summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/usb.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-04-07 11:57:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-04-11 08:33:48 +0200
commitc5d95eb4c72a2639c10d01a801df00b4c34db315 (patch)
tree5b8c0afce59f832d2f102e4114feb3c16ffd98a0 /drivers/usb/core/usb.c
parentc0511abbd1fa99ee8eff80d5bf207ff5f349cf8a (diff)
downloadbarebox-c5d95eb4c72a2639c10d01a801df00b4c34db315.tar.gz
barebox-c5d95eb4c72a2639c10d01a801df00b4c34db315.tar.xz
param: make parameter functions more consistent
This patch creates a consitent set of device parameter functions. With this we have: dev_add_param_<type><access> "type" is one of: int32, uint32, int64, uint64, string, mac, ipv4, enum, bitmask The improvement here is that we now can exactly specify the width of the int type parameters and also correctly distinguish between signed and unsigned variables which means that a variable no longer ends up with INT_MAX when it's assigned -1. "access" can be empty for regular read/write parameter, "_ro" for readonly parameters which get their value from a variable pointer in the background or "_fixed" for parameters which are set to a fixed value (without a pointer in the background). Some more exotic types are not (yet) implemented, like dev_add_param_ip_ro. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/core/usb.c')
-rw-r--r--drivers/usb/core/usb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index aba2da0ad3..9170ba4d53 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -447,19 +447,19 @@ int usb_new_device(struct usb_device *dev)
goto err_out;
}
- dev_add_param_int_ro(&dev->dev, "iManufacturer",
- dev->descriptor->iManufacturer, "%d");
- dev_add_param_int_ro(&dev->dev, "iProduct",
- dev->descriptor->iProduct, "%d");
- dev_add_param_int_ro(&dev->dev, "iSerialNumber",
- dev->descriptor->iSerialNumber, "%d");
+ dev_add_param_uint32_fixed(&dev->dev, "iManufacturer",
+ dev->descriptor->iManufacturer, "%u");
+ dev_add_param_uint32_fixed(&dev->dev, "iProduct",
+ dev->descriptor->iProduct, "%u");
+ dev_add_param_uint32_fixed(&dev->dev, "iSerialNumber",
+ dev->descriptor->iSerialNumber, "%u");
dev_add_param_fixed(&dev->dev, "iSerialNumber", str);
dev_add_param_fixed(&dev->dev, "Manufacturer", dev->mf);
dev_add_param_fixed(&dev->dev, "Product", dev->prod);
dev_add_param_fixed(&dev->dev, "SerialNumber", dev->serial);
- dev_add_param_int_ro(&dev->dev, "idVendor",
+ dev_add_param_uint32_fixed(&dev->dev, "idVendor",
dev->descriptor->idVendor, "%04x");
- dev_add_param_int_ro(&dev->dev, "idProduct",
+ dev_add_param_uint32_fixed(&dev->dev, "idProduct",
dev->descriptor->idProduct, "%04x");
list_add_tail(&dev->list, &usb_device_list);
dev_count++;