Fixes for many warnings and errors as reported by checkpatch.pl
Signed-off-by: Asheesh Ranjan <[email protected]>
---
drivers/uwb/address.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/uwb/address.c b/drivers/uwb/address.c
index 8739c4f..9a45ffd 100644
--- a/drivers/uwb/address.c
+++ b/drivers/uwb/address.c
@@ -46,7 +46,7 @@ struct uwb_rc_cmd_dev_addr_mgmt {
*
* @hwarc: HWA Radio Control interface instance
* @bmOperationType:
- * Set/get, MAC/DEV (see WUSB1.0[8.6.2.2])
+ * Set/get, MAC/DEV (see WUSB1.0[8.6.2.2])
* @baAddr: address buffer--assumed to have enough data to hold
* the address type requested.
* @reply: Pointer to reply buffer (can be stack allocated)
@@ -72,10 +72,16 @@ int uwb_rc_dev_addr_mgmt(struct uwb_rc *rc,
cmd->bmOperationType = bmOperationType;
if (baAddr) {
size_t size = 0;
+
switch (bmOperationType >> 1) {
- case 0: size = 2; break;
- case 1: size = 6; break;
- default: BUG();
+ case 0:
+ size = 2;
+ break;
+ case 1:
+ size = 6;
+ break;
+ default:
+ BUG();
}
memcpy(cmd->baAddr, baAddr, size);
}
@@ -125,7 +131,7 @@ static int uwb_rc_addr_set(struct uwb_rc *rc,
const void *_addr, enum uwb_addr_type type)
{
int result;
- u8 bmOperationType = 0x1; /* Set address */
+ u8 bmOperationType = 0x1; /* Set address */
const struct uwb_dev_addr *dev_addr = _addr;
const struct uwb_mac_addr *mac_addr = _addr;
struct uwb_rc_evt_dev_addr_mgmt reply;
@@ -163,7 +169,7 @@ static int uwb_rc_addr_get(struct uwb_rc *rc,
void *_addr, enum uwb_addr_type type)
{
int result;
- u8 bmOperationType = 0x0; /* Get address */
+ u8 bmOperationType = 0x0; /* Get address */
struct uwb_rc_evt_dev_addr_mgmt evt;
struct uwb_dev_addr *dev_addr = _addr;
struct uwb_mac_addr *mac_addr = _addr;
@@ -220,6 +226,7 @@ int uwb_rc_mac_addr_set(struct uwb_rc *rc,
const struct uwb_mac_addr *addr)
{
int result = -EINVAL;
+
mutex_lock(&rc->uwb_dev.mutex);
result = uwb_rc_addr_set(rc, addr, UWB_ADDR_MAC);
mutex_unlock(&rc->uwb_dev.mutex);
@@ -232,6 +239,7 @@ int uwb_rc_dev_addr_set(struct uwb_rc *rc,
const struct uwb_dev_addr *addr)
{
int result = -EINVAL;
+
mutex_lock(&rc->uwb_dev.mutex);
result = uwb_rc_addr_set(rc, addr, UWB_ADDR_DEV);
rc->uwb_dev.dev_addr = *addr;
@@ -255,6 +263,7 @@ int __uwb_dev_addr_assigned_check(struct device *dev, void
*_addr)
{
struct uwb_dev *uwb_dev = to_uwb_dev(dev);
struct uwb_dev_addr *addr = _addr;
+
if (!uwb_dev_addr_cmp(addr, &uwb_dev->dev_addr))
return !0;
return 0;
@@ -362,6 +371,7 @@ size_t __uwb_addr_print(char *buf, size_t buf_size, const
unsigned char *addr,
int type)
{
size_t result;
+
if (type)
result = scnprintf(buf, buf_size, "%pM", addr);
else
--
1.7.10.4
--
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