* [PATCH 1/5] silicom: checkpatch: assignments in if conditions
@ 2013-06-17 14:20 Lorenz Haspel
2013-06-17 14:20 ` [PATCH 2/5] silicom: checkpatch: fixed whitespace errors Lorenz Haspel
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Lorenz Haspel @ 2013-06-17 14:20 UTC (permalink / raw)
To: devel
Cc: gregkh, puff65537, viro, michael.banken, dan.carpenter, devel,
linux-kernel, linux-kernel, Lorenz Haspel
Fixes checkpatch error:
There were assignments in if conditions, so I extracted them.
Signed-off-by: Michael Banken <michael.banken@mathe.stud.uni-erlangen.de>
Signed-off-by: Lorenz Haspel <lorenz@badgers.com>
---
drivers/staging/silicom/bpctl_mod.c | 172 ++++++++++++++++++++---------------
1 file changed, 98 insertions(+), 74 deletions(-)
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index b7e570c..69100c9 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -245,9 +245,11 @@ static int bp_device_event(struct notifier_block *unused,
case NETDEV_CHANGE:{
if (netif_carrier_ok(dev))
return NOTIFY_DONE;
-
- if (((dev_num = get_dev_idx(dev->ifindex)) == -1) ||
- (!(pbpctl_dev = &bpctl_dev_arr[dev_num])))
+ dev_num = get_dev_idx(dev->ifindex);
+ if (dev_num == -1)
+ return NOTIFY_DONE;
+ pbpctl_dev = &bpctl_dev_arr[dev_num];
+ if (!pbpctl_dev)
return NOTIFY_DONE;
if ((is_bypass_fn(pbpctl_dev)) == 1)
@@ -306,7 +308,8 @@ static void write_pulse(bpctl_dev_t *pbpctl_dev,
ctrl = BP10G_READ_REG(pbpctl_dev, ESDP);
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return;
ctrl = BP10G_READ_REG(pbpctl_dev_c, ESDP);
}
@@ -606,7 +609,8 @@ static int read_pulse(bpctl_dev_t *pbpctl_dev, unsigned int ctrl_ext,
if (pbpctl_dev->bp_540)
ctrl = BP10G_READ_REG(pbpctl_dev, ESDP);
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return -1;
ctrl = BP10G_READ_REG(pbpctl_dev_c, ESDP);
}
@@ -775,7 +779,8 @@ static void write_reg(bpctl_dev_t *pbpctl_dev, unsigned char value,
bpctl_dev_t *pbpctl_dev_c = NULL;
unsigned long flags;
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return;
}
if ((pbpctl_dev->wdt_status == WDT_STATUS_EN) &&
@@ -953,7 +958,8 @@ static int read_reg(bpctl_dev_t *pbpctl_dev, unsigned char addr)
atomic_set(&pbpctl_dev->wdt_busy, 1);
#endif
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return -1;
}
@@ -1224,7 +1230,8 @@ static int wdt_pulse(bpctl_dev_t *pbpctl_dev)
return -1;
#endif
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return -1;
}
@@ -1743,8 +1750,8 @@ static void write_data_port_int(bpctl_dev_t *pbpctl_dev,
static int write_data_int(bpctl_dev_t *pbpctl_dev, unsigned char value)
{
bpctl_dev_t *pbpctl_dev_b = NULL;
-
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return -1;
atomic_set(&pbpctl_dev->wdt_busy, 1);
write_data_port_int(pbpctl_dev, value & 0x3);
@@ -1965,7 +1972,8 @@ int tpl_hw_on(bpctl_dev_t *pbpctl_dev)
int ret = 0, ctrl = 0;
bpctl_dev_t *pbpctl_dev_b = NULL;
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;
if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) {
@@ -1991,8 +1999,8 @@ int tpl_hw_off(bpctl_dev_t *pbpctl_dev)
{
int ret = 0, ctrl = 0;
bpctl_dev_t *pbpctl_dev_b = NULL;
-
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;
if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) {
cmnd_on(pbpctl_dev);
@@ -2373,11 +2381,10 @@ static int set_tx(bpctl_dev_t *pbpctl_dev, int tx_state)
if (PEG5_IF_SERIES(pbpctl_dev->subdevice)) {
if (tx_state) {
uint16_t mii_reg;
- if (!
- (ret =
- bp75_read_phy_reg(pbpctl_dev,
+ ret = bp75_read_phy_reg(pbpctl_dev,
BPCTLI_PHY_CONTROL,
- &mii_reg))) {
+ &mii_reg);
+ if (!ret) {
if (mii_reg & BPCTLI_MII_CR_POWER_DOWN) {
ret =
bp75_write_phy_reg
@@ -2389,12 +2396,10 @@ static int set_tx(bpctl_dev_t *pbpctl_dev, int tx_state)
}
} else {
uint16_t mii_reg;
- if (!
- (ret =
- bp75_read_phy_reg(pbpctl_dev,
+ ret = bp75_read_phy_reg(pbpctl_dev,
BPCTLI_PHY_CONTROL,
- &mii_reg))) {
-
+ &mii_reg);
+ if (!ret) {
mii_reg |= BPCTLI_MII_CR_POWER_DOWN;
ret =
bp75_write_phy_reg(pbpctl_dev,
@@ -3237,30 +3242,33 @@ int bypass_from_last_read(bpctl_dev_t *pbpctl_dev)
uint32_t ctrl_ext = 0;
bpctl_dev_t *pbpctl_dev_b = NULL;
- if ((pbpctl_dev->bp_caps & SW_CTL_CAP)
- && (pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) {
- ctrl_ext = BPCTL_READ_REG(pbpctl_dev_b, CTRL_EXT);
- BPCTL_BP_WRITE_REG(pbpctl_dev_b, CTRL_EXT,
+ if (pbpctl_dev->bp_caps & SW_CTL_CAP) {
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (pbpctl_dev_b) {
+ ctrl_ext = BPCTL_READ_REG(pbpctl_dev_b, CTRL_EXT);
+ BPCTL_BP_WRITE_REG(pbpctl_dev_b, CTRL_EXT,
(ctrl_ext & ~BPCTLI_CTRL_EXT_SDP7_DIR));
- ctrl_ext = BPCTL_READ_REG(pbpctl_dev_b, CTRL_EXT);
- if (ctrl_ext & BPCTLI_CTRL_EXT_SDP7_DATA)
- return 0;
- return 1;
- } else
- return BP_NOT_CAP;
+ ctrl_ext = BPCTL_READ_REG(pbpctl_dev_b, CTRL_EXT);
+ if (ctrl_ext & BPCTLI_CTRL_EXT_SDP7_DATA)
+ return 0;
+ return 1;
+ }
+ }
+ return BP_NOT_CAP;
}
int bypass_status_clear(bpctl_dev_t *pbpctl_dev)
{
bpctl_dev_t *pbpctl_dev_b = NULL;
- if ((pbpctl_dev->bp_caps & SW_CTL_CAP)
- && (pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) {
-
- send_bypass_clear_pulse(pbpctl_dev_b, 1);
- return 0;
- } else
- return BP_NOT_CAP;
+ if (pbpctl_dev->bp_caps & SW_CTL_CAP) {
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (pbpctl_dev_b) {
+ send_bypass_clear_pulse(pbpctl_dev_b, 1);
+ return 0;
+ }
+ }
+ return BP_NOT_CAP;
}
int bypass_flag_status(bpctl_dev_t *pbpctl_dev)
@@ -3328,8 +3336,8 @@ static int bypass_status(bpctl_dev_t *pbpctl_dev)
if (pbpctl_dev->bp_caps & BP_CAP) {
bpctl_dev_t *pbpctl_dev_b = NULL;
-
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;
if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) {
@@ -3616,8 +3624,8 @@ int tap_status(bpctl_dev_t *pbpctl_dev)
if (pbpctl_dev->bp_caps & TAP_CAP) {
bpctl_dev_t *pbpctl_dev_b = NULL;
-
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;
if (pbpctl_dev->bp_ext_ver >= 0x8) {
@@ -3713,7 +3721,8 @@ int disc_off_status(bpctl_dev_t *pbpctl_dev)
u32 ctrl_ext = 0;
if (pbpctl_dev->bp_caps & DISC_CAP) {
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;
if (DISCF_IF_SERIES(pbpctl_dev->subdevice))
return ((((read_reg(pbpctl_dev, STATUS_DISC_REG_ADDR)) &
@@ -3794,8 +3803,8 @@ static int disc_status(bpctl_dev_t *pbpctl_dev)
{
int ctrl = 0;
if (pbpctl_dev->bp_caps & DISC_CAP) {
-
- if ((ctrl = disc_off_status(pbpctl_dev)) < 0)
+ ctrl = disc_off_status(pbpctl_dev);
+ if (ctrl < 0)
return ctrl;
return ((ctrl == 0) ? 1 : 0);
@@ -3910,8 +3919,8 @@ int tpl2_flag_status(bpctl_dev_t *pbpctl_dev)
int tpl_hw_status(bpctl_dev_t *pbpctl_dev)
{
bpctl_dev_t *pbpctl_dev_b = NULL;
-
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;
if (TPL_IF_SERIES(pbpctl_dev->subdevice))
@@ -4216,8 +4225,8 @@ void bypass_caps_init(bpctl_dev_t *pbpctl_dev)
int bypass_off_init(bpctl_dev_t *pbpctl_dev)
{
int ret = 0;
-
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (INTEL_IF_SERIES(pbpctl_dev->subdevice))
return dis_bypass_cap(pbpctl_dev);
@@ -4403,7 +4412,8 @@ int set_bypass_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)
if (!(pbpctl_dev->bp_caps & BP_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (!bypass_mode)
ret = bypass_off(pbpctl_dev);
@@ -4435,7 +4445,8 @@ int set_dis_bypass_fn(bpctl_dev_t *pbpctl_dev, int dis_param)
if (!(pbpctl_dev->bp_caps & BP_DIS_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (dis_param)
ret = dis_bypass_cap(pbpctl_dev);
@@ -4461,11 +4472,13 @@ int set_bypass_pwoff_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)
if (!(pbpctl_dev->bp_caps & BP_PWOFF_CTL_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (bypass_mode)
ret = bypass_state_pwroff(pbpctl_dev);
- else
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
ret = normal_state_pwroff(pbpctl_dev);
cmnd_off(pbpctl_dev);
return ret;
@@ -4487,7 +4500,8 @@ int set_bypass_pwup_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)
if (!(pbpctl_dev->bp_caps & BP_PWUP_CTL_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (bypass_mode)
ret = bypass_state_pwron(pbpctl_dev);
@@ -4514,7 +4528,8 @@ int set_bypass_wd_fn(bpctl_dev_t *pbpctl_dev, int timeout)
if (!(pbpctl_dev->bp_caps & WD_CTL_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (!timeout)
ret = wdt_off(pbpctl_dev);
@@ -4583,7 +4598,8 @@ int set_std_nic_fn(bpctl_dev_t *pbpctl_dev, int nic_mode)
if (!(pbpctl_dev->bp_caps & STD_NIC_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (nic_mode)
ret = std_nic_on(pbpctl_dev);
@@ -4648,8 +4664,8 @@ int get_tap_pwup_fn(bpctl_dev_t *pbpctl_dev)
int ret = 0;
if (!pbpctl_dev)
return -1;
-
- if ((ret = default_pwron_tap_status(pbpctl_dev)) < 0)
+ ret = default_pwron_tap_status(pbpctl_dev);
+ if (ret < 0)
return ret;
return ((ret == 0) ? 1 : 0);
}
@@ -4823,8 +4839,8 @@ int get_disc_port_pwup_fn(bpctl_dev_t *pbpctl_dev)
int ret = 0;
if (!pbpctl_dev)
return -1;
-
- if ((ret = default_pwron_disc_port_status(pbpctl_dev)) < 0)
+ ret = default_pwron_disc_port_status(pbpctl_dev);
+ if (ret < 0)
return ret;
return ((ret == 0) ? 1 : 0);
}
@@ -4851,7 +4867,8 @@ int reset_cont_fn(bpctl_dev_t *pbpctl_dev)
if (!pbpctl_dev)
return -1;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
return reset_cont(pbpctl_dev);
}
@@ -4867,10 +4884,12 @@ int set_tx_fn(bpctl_dev_t *pbpctl_dev, int tx_state)
(pbpctl_dev->bp_caps & SW_CTL_CAP)) {
if ((pbpctl_dev->bp_tpl_flag))
return BP_NOT_CAP;
- } else if ((pbpctl_dev_b = get_master_port_fn(pbpctl_dev))) {
- if ((pbpctl_dev_b->bp_caps & TPL_CAP) &&
- (pbpctl_dev_b->bp_tpl_flag))
- return BP_NOT_CAP;
+ } else {
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (pbpctl_dev_b)
+ if ((pbpctl_dev_b->bp_caps & TPL_CAP) &&
+ (pbpctl_dev_b->bp_tpl_flag))
+ return BP_NOT_CAP;
}
return set_tx(pbpctl_dev, tx_state);
}
@@ -4984,10 +5003,13 @@ int get_tx_fn(bpctl_dev_t *pbpctl_dev)
(pbpctl_dev->bp_caps & SW_CTL_CAP)) {
if ((pbpctl_dev->bp_tpl_flag))
return BP_NOT_CAP;
- } else if ((pbpctl_dev_b = get_master_port_fn(pbpctl_dev))) {
- if ((pbpctl_dev_b->bp_caps & TPL_CAP) &&
- (pbpctl_dev_b->bp_tpl_flag))
- return BP_NOT_CAP;
+ } else{
+ pbpctl_dev_b = get_master_port_fn(pbpctl_dev);
+ if (pbpctl_dev_b) {
+ if ((pbpctl_dev_b->bp_caps & TPL_CAP) &&
+ (pbpctl_dev_b->bp_tpl_flag))
+ return BP_NOT_CAP;
+ }
}
return tx_status(pbpctl_dev);
}
@@ -5023,8 +5045,8 @@ static void bp_tpl_timer_fn(unsigned long param)
bpctl_dev_t *pbpctl_dev = (bpctl_dev_t *) param;
uint32_t link1, link2;
bpctl_dev_t *pbpctl_dev_b = NULL;
-
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return;
if (!pbpctl_dev->bp_tpl_flag) {
@@ -5128,7 +5150,8 @@ int set_tpl_fn(bpctl_dev_t *pbpctl_dev, int tpl_mode)
if (pbpctl_dev->bp_caps & TPL_CAP) {
if (tpl_mode) {
- if ((pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (pbpctl_dev_b)
set_tx(pbpctl_dev_b, 1);
set_tx(pbpctl_dev, 1);
}
@@ -6708,7 +6731,8 @@ static int init_one(bpctl_dev_t *dev, bpmod_info_t *info, struct pci_dev *pdev1)
reset_cont(dev);
}
#ifdef BP_SELF_TEST
- if ((dev->bp_tx_data = kzalloc(BPTEST_DATA_LEN, GFP_KERNEL))) {
+ dev->bp_tx_data = kzalloc(BPTEST_DATA_LEN, GFP_KERNEL);
+ if (dev->bp_tx_data) {
memset(dev->bp_tx_data, 0xff, 6);
memset(dev->bp_tx_data + 6, 0x0, 1);
memset(dev->bp_tx_data + 7, 0xaa, 5);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/5] silicom: checkpatch: fixed whitespace errors
2013-06-17 14:20 [PATCH 1/5] silicom: checkpatch: assignments in if conditions Lorenz Haspel
@ 2013-06-17 14:20 ` Lorenz Haspel
2013-06-17 15:20 ` Dan Carpenter
2013-06-17 14:20 ` [PATCH 3/5] silicom: checkpatch: explicit initialised statics Lorenz Haspel
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Lorenz Haspel @ 2013-06-17 14:20 UTC (permalink / raw)
To: devel
Cc: gregkh, puff65537, viro, michael.banken, dan.carpenter, devel,
linux-kernel, linux-kernel, Lorenz Haspel, Michael Banken
started cleanfile
also fixed some other whitespace errors cleanfile didn't find
Signed-off-by: Michael Banken <michael.banken@mathe.stud.uni-erlangen>
Signed-off-by: Lorenz Haspel <lorenz@badgers.com>
---
drivers/staging/silicom/bpctl_mod.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 69100c9..2420383 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -43,12 +43,12 @@ MODULE_DESCRIPTION(BP_MOD_DESCR);
MODULE_VERSION(BP_MOD_VER);
spinlock_t bpvm_lock;
-#define lock_bpctl() \
+#define lock_bpctl() \
if (down_interruptible(&bpctl_sema)) { \
return -ERESTARTSYS; \
} \
-#define unlock_bpctl() \
+#define unlock_bpctl() \
up(&bpctl_sema);
/* Media Types */
@@ -1421,8 +1421,8 @@ static int wdt_pulse(bpctl_dev_t *pbpctl_dev)
(ctrl_ext &
~(BP10G_MCLK_DATA_OUT | BP10G_MDIO_DATA_OUT)));
}
- if ((pbpctl_dev->wdt_status == WDT_STATUS_EN) /*&&
- (pbpctl_dev->bp_ext_ver<PXG4BPFI_VER) */ )
+ if ((pbpctl_dev->wdt_status == WDT_STATUS_EN))
+ /*&& (pbpctl_dev->bp_ext_ver<PXG4BPFI_VER) */
pbpctl_dev->bypass_wdt_on_time = jiffies;
#ifdef BP_SYNC_FLAG
spin_unlock_irqrestore(&pbpctl_dev->bypass_wr_lock, flags);
@@ -4343,7 +4343,7 @@ int get_bypass_wd_auto(bpctl_dev_t *pbpctl_dev)
return BP_NOT_CAP;
}
-#ifdef BP_SELF_TEST
+#ifdef BP_SELF_TEST
int set_bp_self_test(bpctl_dev_t *pbpctl_dev, unsigned int param)
{
@@ -5461,9 +5461,9 @@ static long device_ioctl(struct file *file, /* see include/linux/fs.h */
return -1;
}
-/* preempt_disable();
+/* preempt_disable();
rcu_read_lock();
- spin_lock_irqsave(&bpvm_lock, flags);
+ spin_lock_irqsave(&bpvm_lock, flags);
*/
if ((bpctl_cmd.in_param[5]) ||
(bpctl_cmd.in_param[6]) || (bpctl_cmd.in_param[7]))
@@ -5810,7 +5810,7 @@ static const struct file_operations Fops = {
};
#ifndef PCI_DEVICE
-#define PCI_DEVICE(vend,dev) \
+#define PCI_DEVICE(vend, dev) \
.vendor = (vend), .device = (dev), \
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
#endif
@@ -6652,7 +6652,7 @@ static void find_fw(bpctl_dev_t *dev)
ioremap(mmio_start, mmio_len);
dev->bp_fw_ver = bypass_fw_ver(dev);
- if (dev-> bp_fw_ver == 0xa8)
+ if (dev->bp_fw_ver == 0xa8)
break;
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/5] silicom: checkpatch: explicit initialised statics
2013-06-17 14:20 [PATCH 1/5] silicom: checkpatch: assignments in if conditions Lorenz Haspel
2013-06-17 14:20 ` [PATCH 2/5] silicom: checkpatch: fixed whitespace errors Lorenz Haspel
@ 2013-06-17 14:20 ` Lorenz Haspel
2013-06-17 14:20 ` [PATCH 4/5] silicom: checkpatch: trailing statements Lorenz Haspel
2013-06-17 14:20 ` [PATCH 5/5] solicom: checkpatch: added parenthesis to macros Lorenz Haspel
3 siblings, 0 replies; 8+ messages in thread
From: Lorenz Haspel @ 2013-06-17 14:20 UTC (permalink / raw)
To: devel
Cc: gregkh, puff65537, viro, michael.banken, dan.carpenter, devel,
linux-kernel, linux-kernel, Lorenz Haspel
fixed checkpatch error:
removed expicit initialisations of statics to 0 or NULL
Signed-off-by: Michael Banken <michael.banken@mathe.stud.uni-erlangen.de>
Signed-off-by: Lorenz Haspel <lorenz@badgers.com>
---
drivers/staging/silicom/bpctl_mod.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 2420383..78570dd 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -35,7 +35,7 @@
#define BP_MOD_DESCR "Silicom Bypass-SD Control driver"
#define BP_SYNC_FLAG 1
-static int major_num = 0;
+static int major_num;
MODULE_AUTHOR("Anna Lukin, annal@silicom.co.il");
MODULE_LICENSE("GPL");
@@ -112,7 +112,7 @@ typedef struct _bpctl_dev {
static bpctl_dev_t *bpctl_dev_arr;
static struct semaphore bpctl_sema;
-static int device_num = 0;
+static int device_num;
static int get_dev_idx(int ifindex);
static bpctl_dev_t *get_master_port_fn(bpctl_dev_t *pbpctl_dev);
@@ -134,7 +134,7 @@ static int bp_device_event(struct notifier_block *unused,
unsigned long event, void *ptr)
{
struct net_device *dev = ptr;
- static bpctl_dev_t *pbpctl_dev = NULL, *pbpctl_dev_m = NULL;
+ static bpctl_dev_t *pbpctl_dev, *pbpctl_dev_m;
int dev_num = 0, ret = 0, ret_d = 0, time_left = 0;
/* printk("BP_PROC_SUPPORT event =%d %s %d\n", event,dev->name, dev->ifindex ); */
/* return NOTIFY_DONE; */
@@ -7855,7 +7855,7 @@ RW_FOPS(wd_autoreset)
int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block)
{
struct bypass_pfs_sd *current_pfs = &(pbp_device_block->bypass_pfs_set);
- static struct proc_dir_entry *procfs_dir = NULL;
+ static struct proc_dir_entry *procfs_dir;
int ret = 0;
if (!pbp_device_block->ndev)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] silicom: checkpatch: trailing statements
2013-06-17 14:20 [PATCH 1/5] silicom: checkpatch: assignments in if conditions Lorenz Haspel
2013-06-17 14:20 ` [PATCH 2/5] silicom: checkpatch: fixed whitespace errors Lorenz Haspel
2013-06-17 14:20 ` [PATCH 3/5] silicom: checkpatch: explicit initialised statics Lorenz Haspel
@ 2013-06-17 14:20 ` Lorenz Haspel
2013-06-17 15:28 ` Dan Carpenter
2013-06-17 14:20 ` [PATCH 5/5] solicom: checkpatch: added parenthesis to macros Lorenz Haspel
3 siblings, 1 reply; 8+ messages in thread
From: Lorenz Haspel @ 2013-06-17 14:20 UTC (permalink / raw)
To: devel
Cc: gregkh, puff65537, viro, michael.banken, dan.carpenter, devel,
linux-kernel, linux-kernel, Lorenz Haspel
fixed checkpatch error:
trailing statements that should be on next line
Signed-off-by: Michael Banken <michael.banken@mathe.stud.uni-erlangen.de>
Signed-off-by: Lorenz Haspel <lorenz@badgers.com>
---
drivers/staging/silicom/bpctl_mod.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 78570dd..85aa900 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -165,7 +165,9 @@ static int bp_device_event(struct notifier_block *unused,
memcpy(&cbuf, drvinfo.bus_info, 32);
buf = &cbuf[0];
- while (*buf++ != ':') ;
+ while (*buf != ':')
+ buf++;
+ buf++;
for (i = 0; i < 10; i++, buf++) {
if (*buf == ':')
break;
@@ -2158,12 +2160,14 @@ static void bp75_release_phy(bpctl_dev_t *pbpctl_dev)
{
u16 mask = BPCTLI_SWFW_PHY0_SM;
u32 swfw_sync;
+ s32 ret_val;
if ((pbpctl_dev->func == 1) || (pbpctl_dev->func == 3))
mask = BPCTLI_SWFW_PHY1_SM;
- while (bp75_get_hw_semaphore_generic(pbpctl_dev) != 0) ;
- /* Empty */
+ do
+ ret_val = bp75_get_hw_semaphore_generic(pbpctl_dev);
+ while (ret_val != 0);
swfw_sync = BPCTL_READ_REG(pbpctl_dev, SW_FW_SYNC);
swfw_sync &= ~mask;
@@ -5368,7 +5372,9 @@ static void if_scan_init(void)
memcpy(&cbuf, drvinfo.bus_info, 32);
buf = &cbuf[0];
- while (*buf++ != ':') ;
+ while (*buf != ':')
+ buf++;
+ buf++;
for (i = 0; i < 10; i++, buf++) {
if (*buf == ':')
break;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/5] solicom: checkpatch: added parenthesis to macros
2013-06-17 14:20 [PATCH 1/5] silicom: checkpatch: assignments in if conditions Lorenz Haspel
` (2 preceding siblings ...)
2013-06-17 14:20 ` [PATCH 4/5] silicom: checkpatch: trailing statements Lorenz Haspel
@ 2013-06-17 14:20 ` Lorenz Haspel
3 siblings, 0 replies; 8+ messages in thread
From: Lorenz Haspel @ 2013-06-17 14:20 UTC (permalink / raw)
To: devel
Cc: gregkh, puff65537, viro, michael.banken, dan.carpenter, devel,
linux-kernel, linux-kernel, Lorenz Haspel
fixed checkpatch error:
added parenthesis around complex macros.
Signed-off-by: Michael Banken <michael.banken@mathe.stud.uni-erlangen.de>
Signed-off-by: Lorenz Haspel <lorenz@badgers.com>
---
drivers/staging/silicom/bpctl_mod.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 85aa900..9d77924 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -44,9 +44,11 @@ MODULE_VERSION(BP_MOD_VER);
spinlock_t bpvm_lock;
#define lock_bpctl() \
-if (down_interruptible(&bpctl_sema)) { \
- return -ERESTARTSYS; \
-} \
+do { \
+ if (down_interruptible(&bpctl_sema)) { \
+ return -ERESTARTSYS; \
+ } \
+} while (0)
#define unlock_bpctl() \
up(&bpctl_sema);
@@ -7881,7 +7883,8 @@ int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block)
}
current_pfs->bypass_entry = procfs_dir;
-#define ENTRY(x) ret |= procfs_add(#x, &x##_ops, pbp_device_block)
+#define ENTRY(x) (ret |= procfs_add(#x, &x##_ops, pbp_device_block))
+
ENTRY(bypass_info);
if (pbp_device_block->bp_caps & SW_CTL_CAP) {
/* Create set param proc's */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/5] silicom: checkpatch: fixed whitespace errors
2013-06-17 14:20 ` [PATCH 2/5] silicom: checkpatch: fixed whitespace errors Lorenz Haspel
@ 2013-06-17 15:20 ` Dan Carpenter
2013-06-17 15:34 ` Dan Carpenter
0 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2013-06-17 15:20 UTC (permalink / raw)
To: Lorenz Haspel
Cc: devel, gregkh, puff65537, viro, michael.banken, devel,
linux-kernel, linux-kernel, Michael Banken
On Mon, Jun 17, 2013 at 04:20:14PM +0200, Lorenz Haspel wrote:
> started cleanfile
> also fixed some other whitespace errors cleanfile didn't find
>
> Signed-off-by: Michael Banken <michael.banken@mathe.stud.uni-erlangen>
> Signed-off-by: Lorenz Haspel <lorenz@badgers.com>
I assume this came from Michael Banken? The first line of the body
of the email should say:
From: Michael Banken <michael.banken@mathe.stud.uni-erlangen>
so that git assigns credit properly. Also the ".de" is missing from
that email.
This patch doesn't apply because someone just did some work on that
file.
Please resend the whole patch so it applies to linux-next and
assigns credit correctly.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] silicom: checkpatch: trailing statements
2013-06-17 14:20 ` [PATCH 4/5] silicom: checkpatch: trailing statements Lorenz Haspel
@ 2013-06-17 15:28 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-06-17 15:28 UTC (permalink / raw)
To: Lorenz Haspel
Cc: devel, gregkh, puff65537, viro, michael.banken, devel,
linux-kernel, linux-kernel
On Mon, Jun 17, 2013 at 04:20:16PM +0200, Lorenz Haspel wrote:
> fixed checkpatch error:
> trailing statements that should be on next line
>
> Signed-off-by: Michael Banken <michael.banken@mathe.stud.uni-erlangen.de>
> Signed-off-by: Lorenz Haspel <lorenz@badgers.com>
> ---
> drivers/staging/silicom/bpctl_mod.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
> index 78570dd..85aa900 100644
> --- a/drivers/staging/silicom/bpctl_mod.c
> +++ b/drivers/staging/silicom/bpctl_mod.c
> @@ -165,7 +165,9 @@ static int bp_device_event(struct notifier_block *unused,
> memcpy(&cbuf, drvinfo.bus_info, 32);
> buf = &cbuf[0];
>
> - while (*buf++ != ':') ;
> + while (*buf != ':')
> + buf++;
> + buf++;
No. This is more complicated than the original. While loops like
this are idiomatic in C. The way to fix this is just to do:
while (*buf++ != ':')
;
Same for the rest, just move the semi-colon down in every case.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/5] silicom: checkpatch: fixed whitespace errors
2013-06-17 15:20 ` Dan Carpenter
@ 2013-06-17 15:34 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-06-17 15:34 UTC (permalink / raw)
To: Lorenz Haspel
Cc: devel, gregkh, puff65537, viro, michael.banken, devel,
linux-kernel, linux-kernel, Michael Banken
On Mon, Jun 17, 2013 at 06:20:55PM +0300, Dan Carpenter wrote:
> On Mon, Jun 17, 2013 at 04:20:14PM +0200, Lorenz Haspel wrote:
>
> Please resend the whole patch so it applies to linux-next and
> assigns credit correctly.
>
"whole patch series" I meant.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-06-17 15:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-17 14:20 [PATCH 1/5] silicom: checkpatch: assignments in if conditions Lorenz Haspel
2013-06-17 14:20 ` [PATCH 2/5] silicom: checkpatch: fixed whitespace errors Lorenz Haspel
2013-06-17 15:20 ` Dan Carpenter
2013-06-17 15:34 ` Dan Carpenter
2013-06-17 14:20 ` [PATCH 3/5] silicom: checkpatch: explicit initialised statics Lorenz Haspel
2013-06-17 14:20 ` [PATCH 4/5] silicom: checkpatch: trailing statements Lorenz Haspel
2013-06-17 15:28 ` Dan Carpenter
2013-06-17 14:20 ` [PATCH 5/5] solicom: checkpatch: added parenthesis to macros Lorenz Haspel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox