Re: [PATCH] usb: Replace empty define with do while

2018-06-07 Thread Joe Perches
On Thu, 2018-06-07 at 20:05 +, Corentin Labbe wrote:
> It's dangerous to use empty code define.
> Furthermore it lead to the following warning:
> "suggest braces around empty body in an « else » statement"
> 
> So let's replace emptyness by "do {} while(0)"

I also suggest renaming COUNT to something more
intelligible like INCR as the uses are all for
incrementing variables that may not exist.

> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
> index c8e9a48e1d51..a60d91eac771 100644
> --- a/drivers/usb/host/ehci.h
> +++ b/drivers/usb/host/ehci.h
> @@ -237,7 +237,7 @@ struct ehci_hcd { /* one per controller */
>   struct ehci_stats   stats;
>  #define COUNT(x) ((x)++)
>  #else
> -#define COUNT(x)
> +#define COUNT(x) do {} while (0)
>  #endif
>  
>   /* debug files */
> diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h
> index 7fcd785c7bc8..dca46d04e288 100644
> --- a/drivers/usb/host/fotg210.h
> +++ b/drivers/usb/host/fotg210.h
> @@ -179,7 +179,7 @@ struct fotg210_hcd {  /* one per 
> controller */
>   struct fotg210_statsstats;
>  #define COUNT(x) ((x)++)
>  #else
> -#define COUNT(x)
> +#define COUNT(x) do {} while (0)
>  #endif
>  
>   /* debug files */
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] net: drivers/net: Use octal permissions

2018-03-23 Thread Joe Perches
Using octal and not symbolic permissions is preferred by many as
more readable.

https://lkml.org/lkml/2016/8/2/1945

Rather than getting these piecemeal, just do them all.
Done with checkpatch and some typing.

Joe Perches (4):
  ethernet: Use octal not symbolic permissions
  wireless: Use octal not symbolic permissions
  net: Use octal not symbolic permissions
  drivers/net: Use octal not symbolic permissions

 drivers/net/bonding/bond_procfs.c  |   2 +-
 drivers/net/bonding/bond_sysfs.c   |  73 +++---
 drivers/net/bonding/bond_sysfs_slave.c |   4 +-
 drivers/net/caif/caif_serial.c |  32 +++---
 drivers/net/caif/caif_spi.c|  16 +--
 drivers/net/caif/caif_virtio.c |  16 +--
 drivers/net/can/at91_can.c |   3 +-
 drivers/net/can/cc770/cc770.c  |   4 +-
 drivers/net/can/cc770/cc770_isa.c  |  16 +--
 drivers/net/can/grcan.c|   4 +-
 drivers/net/can/janz-ican3.c   |   6 +-
 drivers/net/can/sja1000/sja1000_isa.c  |  14 +--
 drivers/net/can/softing/softing_main.c |   4 +-
 drivers/net/can/spi/mcp251x.c  |   2 +-
 drivers/net/can/usb/esd_usb2.c |   6 +-
 drivers/net/can/vcan.c |   2 +-
 drivers/net/ethernet/8390/apne.c   |   2 +-
 drivers/net/ethernet/8390/lib8390.c|   2 +-
 drivers/net/ethernet/8390/ne.c |   2 +-
 drivers/net/ethernet/8390/ne2k-pci.c   |   2 +-
 drivers/net/ethernet/8390/smc-ultra.c  |   2 +-
 drivers/net/ethernet/8390/stnic.c  |   2 +-
 drivers/net/ethernet/8390/wd.c |   2 +-
 drivers/net/ethernet/altera/altera_tse_main.c  |   6 +-
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c   |  10 +-
 drivers/net/ethernet/amd/xgbe/xgbe-main.c  |   2 +-
 drivers/net/ethernet/broadcom/bnx2.c   |   2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |  12 +--
 drivers/net/ethernet/broadcom/sb1250-mac.c |  10 +-
 drivers/net/ethernet/broadcom/tg3.c|   6 +-
 drivers/net/ethernet/brocade/bna/bnad.c|   2 +-
 drivers/net/ethernet/brocade/bna/bnad_debugfs.c|  10 +-
 drivers/net/ethernet/cavium/thunder/nicvf_main.c   |   2 +-
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c|   6 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 112 ++---
 .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c|  10 +-
 drivers/net/ethernet/ec_bhf.c  |   2 +-
 drivers/net/ethernet/emulex/benet/be_main.c|   6 +-
 drivers/net/ethernet/ibm/ehea/ehea_main.c  |   7 +-
 drivers/net/ethernet/ibm/ibmveth.c |   2 +-
 drivers/net/ethernet/intel/igb/igb_hwmon.c |   2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c |   2 +-
 drivers/net/ethernet/marvell/mvneta.c  |   8 +-
 drivers/net/ethernet/marvell/skge.c|   2 +-
 drivers/net/ethernet/marvell/sky2.c|   2 +-
 drivers/net/ethernet/mellanox/mlx4/main.c  |  16 +--
 drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c   |  10 +-
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c   |  32 +++---
 .../net/ethernet/netronome/nfp/nfp_net_debugfs.c   |   6 +-
 .../net/ethernet/qlogic/netxen/netxen_nic_main.c   |  14 +--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c  |  30 +++---
 drivers/net/ethernet/qualcomm/qca_debug.c  |   2 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c|   4 +-
 drivers/net/ethernet/sfc/mcdi_mon.c|   2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  26 ++---
 drivers/net/ethernet/sun/niu.c |  10 +-
 drivers/net/hamradio/bpqether.c|   3 +-
 drivers/net/hamradio/yam.c |   2 +-
 drivers/net/hyperv/netvsc_drv.c|   4 +-
 drivers/net/ieee802154/at86rf230.c |   2 +-
 drivers/net/phy/spi_ks8995.c   |   2 +-
 drivers/net/ppp/ppp_generic.c  |   2 +-
 drivers/net/ppp/pppoe.c|   2 +-
 drivers/net/usb/cdc_ncm.c  |  12 +--
 drivers/net/usb/hso.c  |   8 +-
 drivers/net/wireless/ath/ath5k/base.c  |   6 +-
 drivers/net/wireless/ath/ath5k/debug.c |  37 ++-
 drivers/net/wireless/ath/ath5k/sysfs.c |   8 +-
 drivers/net/wireless/ath/ath6kl/debug.c|  43 
 drivers/net/wireless/ath/ath9k/common-debug.c  |   9 +-
 drivers/net/wireless/ath/ath9k/common-spectral.c   |  10 +-
 drivers/net/wireless/ath/ath9k/debug.c |  40 
 drivers/net/wireless/ath/ath9k/debug_sta.c |   6 +-
 drivers/net/wireless/ath/ath9k/dfs_debug.c |   4

[PATCH 4/4] drivers/net: Use octal not symbolic permissions

2018-03-23 Thread Joe Perches
Prefer the direct use of octal for permissions.

Done with checkpatch -f --types=SYMBOLIC_PERMS --fix-inplace
and some typing.

Miscellanea:

o Whitespace neatening around these conversions.

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/net/bonding/bond_procfs.c  |  2 +-
 drivers/net/bonding/bond_sysfs.c   | 73 +-
 drivers/net/bonding/bond_sysfs_slave.c |  4 +-
 drivers/net/caif/caif_serial.c | 32 +++
 drivers/net/caif/caif_spi.c| 16 
 drivers/net/caif/caif_virtio.c | 16 
 drivers/net/can/at91_can.c |  3 +-
 drivers/net/can/cc770/cc770.c  |  4 +-
 drivers/net/can/cc770/cc770_isa.c  | 16 
 drivers/net/can/grcan.c|  4 +-
 drivers/net/can/janz-ican3.c   |  6 +--
 drivers/net/can/sja1000/sja1000_isa.c  | 14 +++
 drivers/net/can/softing/softing_main.c |  4 +-
 drivers/net/can/spi/mcp251x.c  |  2 +-
 drivers/net/can/usb/esd_usb2.c |  6 +--
 drivers/net/can/vcan.c |  2 +-
 drivers/net/hamradio/bpqether.c|  3 +-
 drivers/net/hamradio/yam.c |  2 +-
 drivers/net/hyperv/netvsc_drv.c|  4 +-
 drivers/net/ieee802154/at86rf230.c |  2 +-
 drivers/net/phy/spi_ks8995.c   |  2 +-
 drivers/net/ppp/ppp_generic.c  |  2 +-
 drivers/net/ppp/pppoe.c|  2 +-
 drivers/net/usb/cdc_ncm.c  | 12 +++---
 drivers/net/usb/hso.c  |  8 ++--
 drivers/net/xen-netback/xenbus.c   |  4 +-
 drivers/net/xen-netfront.c |  6 +--
 27 files changed, 124 insertions(+), 127 deletions(-)

diff --git a/drivers/net/bonding/bond_procfs.c 
b/drivers/net/bonding/bond_procfs.c
index f7799321dffb..01059f1a7bca 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -287,7 +287,7 @@ void bond_create_proc_entry(struct bonding *bond)
 
if (bn->proc_dir) {
bond->proc_entry = proc_create_data(bond_dev->name,
-   S_IRUGO, bn->proc_dir,
+   0444, bn->proc_dir,
_info_fops, bond);
if (bond->proc_entry == NULL)
netdev_warn(bond_dev, "Cannot create /proc/net/%s/%s\n",
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 040b493f60ae..6096440e96ea 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -147,7 +147,7 @@ static ssize_t bonding_store_bonds(struct class *cls,
 static const struct class_attribute class_attr_bonding_masters = {
.attr = {
.name = "bonding_masters",
-   .mode = S_IWUSR | S_IRUGO,
+   .mode = 0644,
},
.show = bonding_show_bonds,
.store = bonding_store_bonds,
@@ -202,7 +202,7 @@ static ssize_t bonding_show_slaves(struct device *d,
 
return res;
 }
-static DEVICE_ATTR(slaves, S_IRUGO | S_IWUSR, bonding_show_slaves,
+static DEVICE_ATTR(slaves, 0644, bonding_show_slaves,
   bonding_sysfs_store_option);
 
 /* Show the bonding mode. */
@@ -216,8 +216,7 @@ static ssize_t bonding_show_mode(struct device *d,
 
return sprintf(buf, "%s %d\n", val->string, BOND_MODE(bond));
 }
-static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR,
-  bonding_show_mode, bonding_sysfs_store_option);
+static DEVICE_ATTR(mode, 0644, bonding_show_mode, bonding_sysfs_store_option);
 
 /* Show the bonding transmit hash method. */
 static ssize_t bonding_show_xmit_hash(struct device *d,
@@ -231,7 +230,7 @@ static ssize_t bonding_show_xmit_hash(struct device *d,
 
return sprintf(buf, "%s %d\n", val->string, bond->params.xmit_policy);
 }
-static DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR,
+static DEVICE_ATTR(xmit_hash_policy, 0644,
   bonding_show_xmit_hash, bonding_sysfs_store_option);
 
 /* Show arp_validate. */
@@ -247,7 +246,7 @@ static ssize_t bonding_show_arp_validate(struct device *d,
 
return sprintf(buf, "%s %d\n", val->string, bond->params.arp_validate);
 }
-static DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate,
+static DEVICE_ATTR(arp_validate, 0644, bonding_show_arp_validate,
   bonding_sysfs_store_option);
 
 /* Show arp_all_targets. */
@@ -263,7 +262,7 @@ static ssize_t bonding_show_arp_all_targets(struct device 
*d,
return sprintf(buf, "%s %d\n",
   val->string, bond->params.arp_all_targets);
 }
-static DEVICE_ATTR(arp_all_targets, S_IRUGO | S_IWUSR,
+static DEVICE_ATTR(arp_all_targets, 0644,
   bonding_show_arp_all_targets, bonding_sysfs_store_option);
 
 /* Show fail_over_mac. */
@@ -279,7 +278,7 @@ static ssize_

Re: rfc: remove print_vma_addr ? (was Re: [PATCH 00/16] remove eight obsolete architectures)

2018-03-15 Thread Joe Perches
On Thu, 2018-03-15 at 10:08 -0700, Matthew Wilcox wrote:
> On Thu, Mar 15, 2018 at 09:56:46AM -0700, Joe Perches wrote:
> > I have a patchset that creates a vsprintf extension for
> > print_vma_addr and removes all the uses similar to the
> > print_symbol() removal.
> > 
> > This now avoids any possible printk interleaving.
> > 
> > Unfortunately, without some #ifdef in vsprintf, which
> > I would like to avoid, it increases the nommu kernel
> > size by ~500 bytes.
> > 
> > Anyone think this is acceptable?
[]
> This doesn't feel like a huge win since it's only called ~once per
> architecture.  I'd be more excited if it made the printing of the whole
> thing standardised; eg we have a print_fault() function in mm/memory.c
> which takes a suitable set of arguments.

Sure but perhaps that's not feasible as the surrounding output
is per-arch specific.

What could be a standardized fault message here?

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


rfc: remove print_vma_addr ? (was Re: [PATCH 00/16] remove eight obsolete architectures)

2018-03-15 Thread Joe Perches
On Thu, 2018-03-15 at 10:48 +0100, Geert Uytterhoeven wrote:
> Hi David,
> 
> On Thu, Mar 15, 2018 at 10:42 AM, David Howells  wrote:
> > Do we have anything left that still implements NOMMU?
> 
> Sure: arm, c6x, m68k, microblaze, and  sh.

I have a patchset that creates a vsprintf extension for
print_vma_addr and removes all the uses similar to the
print_symbol() removal.

This now avoids any possible printk interleaving.

Unfortunately, without some #ifdef in vsprintf, which
I would like to avoid, it increases the nommu kernel
size by ~500 bytes.

Anyone think this is acceptable?

Here's the overall patch, but I have it as a series
---
 Documentation/core-api/printk-formats.rst |  9 +
 arch/arm64/kernel/traps.c | 13 +++
 arch/mips/mm/fault.c  | 16 -
 arch/parisc/mm/fault.c| 15 
 arch/riscv/kernel/traps.c | 11 +++---
 arch/s390/mm/fault.c  |  7 ++--
 arch/sparc/mm/fault_32.c  |  8 ++---
 arch/sparc/mm/fault_64.c  |  8 ++---
 arch/tile/kernel/signal.c |  9 ++---
 arch/um/kernel/trap.c | 13 +++
 arch/x86/kernel/signal.c  | 10 ++
 arch/x86/kernel/traps.c   | 18 --
 arch/x86/mm/fault.c   | 12 +++
 include/linux/mm.h|  1 -
 lib/vsprintf.c| 58 ++-
 mm/memory.c   | 33 --
 16 files changed, 112 insertions(+), 129 deletions(-)

diff --git a/Documentation/core-api/printk-formats.rst 
b/Documentation/core-api/printk-formats.rst
index 934559b3c130..10a91da1bc83 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -157,6 +157,15 @@ DMA address types dma_addr_t
 For printing a dma_addr_t type which can vary based on build options,
 regardless of the width of the CPU data path.
 
+VMA name and address
+
+
+::
+
+   %pav[hexstart+hexsize] or ?[0+0] if unavailable
+
+For any address, print the vma's name and its starting address and size
+
 Passed by reference.
 
 Raw buffer as an escaped string
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 2b478565d774..48edf812ce8b 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -242,13 +242,14 @@ void arm64_force_sig_info(struct siginfo *info, const 
char *str,
if (!show_unhandled_signals_ratelimited())
goto send_sig;
 
-   pr_info("%s[%d]: unhandled exception: ", tsk->comm, task_pid_nr(tsk));
if (esr)
-   pr_cont("%s, ESR 0x%08x, ", esr_get_class_string(esr), esr);
-
-   pr_cont("%s", str);
-   print_vma_addr(KERN_CONT " in ", regs->pc);
-   pr_cont("\n");
+   pr_info("%s[%d]: unhandled exception: %s, ESR 0x%08x, %s in 
%pav\n",
+   tsk->comm, task_pid_nr(tsk),
+   esr_get_class_string(esr), esr,
+   str, >pc);
+   else
+   pr_info("%s[%d]: unhandled exception: %s in %pav\n",
+   tsk->comm, task_pid_nr(tsk), str, >pc);
__show_regs(regs);
 
 send_sig:
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 4f8f5bf46977..ce7bf077a0f5 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -213,14 +213,14 @@ static void __kprobes __do_page_fault(struct pt_regs 
*regs, unsigned long write,
tsk->comm,
write ? "write access to" : "read access from",
field, address);
-   pr_info("epc = %0*lx in", field,
-   (unsigned long) regs->cp0_epc);
-   print_vma_addr(KERN_CONT " ", regs->cp0_epc);
-   pr_cont("\n");
-   pr_info("ra  = %0*lx in", field,
-   (unsigned long) regs->regs[31]);
-   print_vma_addr(KERN_CONT " ", regs->regs[31]);
-   pr_cont("\n");
+   pr_info("epc = %0*lx in %pav\n",
+   field,
+   (unsigned long)regs->cp0_epc,
+   >cp0_epc);
+   pr_info("ra  = %0*lx in %pav\n",
+   field,
+   (unsigned long)regs->regs[31],
+   >regs[31]);
}
current->thread.trap_nr = (regs->cp0_cause >> 2) & 0x1f;
info.si_signo = SIGSEGV;
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index e247edbca68e..877cea702714 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -240,17 +240,14 @@ show_signal_msg(struct pt_regs *regs, unsigned long 

[PATCH] net: drivers/net: Remove unnecessary skb_copy_expand OOM messages

2018-03-12 Thread Joe Perches
skb_copy_expand without __GFP_NOWARN already does a dump_stack
on OOM so these messages are redundant.

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/net/ethernet/qualcomm/qca_spi.c | 1 -
 drivers/net/usb/lg-vl600.c  | 6 +-
 drivers/net/wimax/i2400m/usb-rx.c   | 3 ---
 drivers/net/wireless/ti/wl1251/tx.c | 4 +---
 drivers/usb/gadget/function/f_eem.c | 1 -
 net/mac80211/rx.c   | 5 +
 net/netfilter/nfnetlink_queue.c | 5 +
 7 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c 
b/drivers/net/ethernet/qualcomm/qca_spi.c
index 9c236298fe21..5803cd6db406 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -705,7 +705,6 @@ qcaspi_netdev_xmit(struct sk_buff *skb, struct net_device 
*dev)
tskb = skb_copy_expand(skb, QCAFRM_HEADER_LEN,
   QCAFRM_FOOTER_LEN + pad_len, GFP_ATOMIC);
if (!tskb) {
-   netdev_dbg(qca->net_dev, "could not allocate 
tx_buff\n");
qca->stats.out_of_mem++;
return NETDEV_TX_BUSY;
}
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c
index dbabd7ca5268..257916f172cd 100644
--- a/drivers/net/usb/lg-vl600.c
+++ b/drivers/net/usb/lg-vl600.c
@@ -157,12 +157,8 @@ static int vl600_rx_fixup(struct usbnet *dev, struct 
sk_buff *skb)
 
s->current_rx_buf = skb_copy_expand(skb, 0,
le32_to_cpup(>len), GFP_ATOMIC);
-   if (!s->current_rx_buf) {
-   netif_err(dev, ifup, dev->net, "Reserving %i bytes "
-   "for packet assembly failed.\n",
-   le32_to_cpup(>len));
+   if (!s->current_rx_buf)
dev->net->stats.rx_errors++;
-   }
 
return 0;
}
diff --git a/drivers/net/wimax/i2400m/usb-rx.c 
b/drivers/net/wimax/i2400m/usb-rx.c
index b78ee676e102..5b64bda7d9e7 100644
--- a/drivers/net/wimax/i2400m/usb-rx.c
+++ b/drivers/net/wimax/i2400m/usb-rx.c
@@ -263,9 +263,6 @@ struct sk_buff *i2400mu_rx(struct i2400mu *i2400mu, struct 
sk_buff *rx_skb)
new_skb = skb_copy_expand(rx_skb, 0, rx_size - rx_skb->len,
  GFP_KERNEL);
if (new_skb == NULL) {
-   if (printk_ratelimit())
-   dev_err(dev, "RX: Can't reallocate skb to %d; "
-   "RX dropped\n", rx_size);
kfree_skb(rx_skb);
rx_skb = NULL;
goto out;   /* drop it...*/
diff --git a/drivers/net/wireless/ti/wl1251/tx.c 
b/drivers/net/wireless/ti/wl1251/tx.c
index de2fa6705574..12ed14ebc307 100644
--- a/drivers/net/wireless/ti/wl1251/tx.c
+++ b/drivers/net/wireless/ti/wl1251/tx.c
@@ -221,10 +221,8 @@ static int wl1251_tx_send_packet(struct wl1251 *wl, struct 
sk_buff *skb,
struct sk_buff *newskb = skb_copy_expand(skb, 0, 3,
 GFP_KERNEL);
 
-   if (unlikely(newskb == NULL)) {
-   wl1251_error("Can't allocate skb!");
+   if (unlikely(newskb == NULL))
return -EINVAL;
-   }
 
tx_hdr = (struct tx_double_buffer_desc *) newskb->data;
 
diff --git a/drivers/usb/gadget/function/f_eem.c 
b/drivers/usb/gadget/function/f_eem.c
index 37557651b600..c13befa31110 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -507,7 +507,6 @@ static int eem_unwrap(struct gether *port,
0,
GFP_ATOMIC);
if (unlikely(!skb3)) {
-   DBG(cdev, "unable to realign EEM packet\n");
dev_kfree_skb_any(skb2);
continue;
}
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index d01743234cf6..9c898a3688c6 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2549,11 +2549,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 
fwd_skb = skb_copy_expand(skb, local->tx_headroom +
   sdata->encrypt_headroom, 0, GFP_ATOMIC);
-   if (!fwd_skb) {
-   net_info_ratelimited("%s: failed to clone mesh frame\n",
-   sdata->name);
+   if (!fwd_skb)
goto out;
-   }
 
fwd_hdr =  (stru

Re: [PATCH 1/2] net/usb/ax88179_178a: Use common code in ax88179_chk_eee()

2018-03-10 Thread Joe Perches
On Sat, 2018-03-10 at 19:24 +0100, SF Markus Elfring wrote:
> From: Markus Elfring 
> Date: Sat, 10 Mar 2018 18:22:43 +0100
> 
> Adjust a jump target so that a bit of common code can be better reused
> at the end of this function.

Please stop mindlessly sending patching Markus.

How about looking at the code being modified and
thinking about what it does?

Try unindenting the block by reversing the first test
and using the same goto set_inactive.

Look at the last & tests
+   if (!(lp & adv & supported))
and see if it should use && or be more simple to read
by using
if (!condition || !

> ---
>  drivers/net/usb/ax88179_178a.c | 34 +++---
>  1 file changed, 11 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
> index f32261ecd215..e4b0baa98e9a 100644
> --- a/drivers/net/usb/ax88179_178a.c
> +++ b/drivers/net/usb/ax88179_178a.c
> @@ -689,49 +689,37 @@ static int ax88179_chk_eee(struct usbnet *dev)
>   eee_cap = ax88179_phy_read_mmd_indirect(dev,
>   MDIO_PCS_EEE_ABLE,
>   MDIO_MMD_PCS);
> - if (eee_cap < 0) {
> - priv->eee_active = 0;
> - return false;
> - }
> + if (eee_cap < 0)
> + goto set_inactive;
>  
>   cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap);
> - if (!cap) {
> - priv->eee_active = 0;
> - return false;
> - }
> + if (!cap)
> + goto set_inactive;
>  
>   eee_lp = ax88179_phy_read_mmd_indirect(dev,
>  MDIO_AN_EEE_LPABLE,
>  MDIO_MMD_AN);
> - if (eee_lp < 0) {
> - priv->eee_active = 0;
> - return false;
> - }
> + if (eee_lp < 0)
> + goto set_inactive;
>  
>   eee_adv = ax88179_phy_read_mmd_indirect(dev,
>   MDIO_AN_EEE_ADV,
>   MDIO_MMD_AN);
> -
> - if (eee_adv < 0) {
> - priv->eee_active = 0;
> - return false;
> - }
> + if (eee_adv < 0)
> + goto set_inactive;
>  
>   adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
>   lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
>   supported = (ecmd.speed == SPEED_1000) ?
>SUPPORTED_1000baseT_Full :
>SUPPORTED_100baseT_Full;
> -
> - if (!(lp & adv & supported)) {
> - priv->eee_active = 0;
> - return false;
> - }
> + if (!(lp & adv & supported))
> + goto set_inactive;
>  
>   priv->eee_active = 1;
>   return true;
>   }
> -
> +set_inactive:
>   priv->eee_active = 0;
>   return false;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW

2017-12-20 Thread Joe Perches
On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > 
> > So here's an opportunity for you:
> > 
> > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > the list of maintained files...
> > 
> > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > M:  Greg Kroah-Hartman 
> > T:  git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > S:  Supported
> > F:  Documentation/kobject.txt
> > F:  drivers/base/
> > F:  fs/debugfs/
> > F:  fs/sysfs/
> > F:  include/linux/debugfs.h
> > F:  include/linux/kobj*
> > F:  lib/kobj*
> 
> Heh, good point, but using get_maintainer.pl does put me at the top of
> the list that you should be cc:ing:
> 
> $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> Greg Kroah-Hartman  
> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
> Kate Stewart  (commit_signer:1/3=33%)
> Thomas Gleixner  (commit_signer:1/3=33%)
> Philippe Ombredanne  (commit_signer:1/3=33%)
> Nick Desaulniers  
> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
> linux-ker...@vger.kernel.org (open list)

The script I use to send patches adds --nogit --nogit-fallback
to copy only listed maintainers because people that send cleanup
patches don't generally like to get random patches.

> > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > 
> > Here's another thing that could be done for more DEVICE_ATTR_ uses.
> > 
> > ===
> > 
> > Some DEVICE_ATTR definitions use a reversed static function form from
> > the typical.  Convert them to use the more common macro form so it is
> > easier to grep for the style.
[]
> > $ git grep --name-only -w DEVICE_ATTR | \
> >   xargs perl -i dev_attr_rw_backwards.perl
> Ah, nice, I love perl :

That was a bad copy/paste of the script.

The actual script for RW is:

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
my $file = $_;
while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
my $var = $1;
if ($file =~ 
s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g)
 {
$file =~ s/\bshow_${var}\b/${var}_show/g;
$file =~ s/\bstore_${var}\b/${var}_store/g;
}
}
print $file;
}

There are 3 different perl scripts for rw, ro, and wo.
and these scripts, because of function renaming and
possible reuse of the original function names by other
string concatenated macros, create some bad conversions
so they need some manual cleanups too.

Perhaps coccinelle could do a better job of it, but
likely string concatenation macro uses are going to
be hard to deal with in any case.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW

2017-12-20 Thread Joe Perches
On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > 
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > 
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > > return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, 
> > > > dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
> > Are you suggesting that device.h (as that is where
> > DEVICE_ATTR and the other DEVICE_ATTR_ variants
> > are #defined) should have better comments for the
> > _ variants?
> > 
> > > DEVICE_ATTR_RW: include/linux/device.h
> > > __ATTR_RW: include/linux/sysfs.h
> > > S_IWUSR: include/uapi/linux/stat.h
> > > S_IRUGO: include/linux/stat.h
> > 
> > btw: patch 1/4 of the series does remove the uses of
> > S_ from these macros in sysfs.h and converts
> > them to simple octal instead.
> 
> Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

So here's an opportunity for you:

The sysfs maintainer hasn't added include/linux/sysfs.h to
the list of maintained files...

DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
M:  Greg Kroah-Hartman <gre...@linuxfoundation.org>
T:  git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
S:  Supported
F:  Documentation/kobject.txt
F:  drivers/base/
F:  fs/debugfs/
F:  fs/sysfs/
F:  include/linux/debugfs.h
F:  include/linux/kobj*
F:  lib/kobj*

> I should be taking this whole series through my tree.  Joe, thanks for
> doing this in an automated way, I've been wanting to see this done for a
> long time.

btw: there are many uses of a reversed declaration style of DEVICE_ATTR

Here's another thing that could be done for more DEVICE_ATTR_ uses.

===

Some DEVICE_ATTR definitions use a reversed static function form from
the typical.  Convert them to use the more common macro form so it is
easier to grep for the style.

i.e.:
static ssize_t show_(...)
and
static ssize_t store_(...)

where the static function names in the DEVICE_ATTR_RW macro are reversed

static ssize_t _show(...)
and
static ssize_t _store(...)

Done with perl script

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
my $file = $_;
while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
my $var = $1;
if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
$file =~ s/\bshow_${var}\b/${var}_show/g;
$file =~ s/\bstore_${var}\b/${var}_store/g;
}
}
print $file;
}

$ git grep --name-only -w DEVICE_ATTR | \
  xargs perl -i dev_attr_rw_backwards.perl


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW

2017-12-20 Thread Joe Perches
On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
[] 
> > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
[]
> > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > return size;
> >  }
> >  
> > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > +static DEVICE_ATTR_RW(dma_op_mode);
> >  
> 
> While I can ack this part here if it helps generic cleanup effort I
> don't understart would it improve code readability in general? Mode 644
> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> through all of these files in order to see what does it mean:

Are you suggesting that device.h (as that is where
DEVICE_ATTR and the other DEVICE_ATTR_ variants
are #defined) should have better comments for the
_ variants?

> DEVICE_ATTR_RW: include/linux/device.h
> __ATTR_RW: include/linux/sysfs.h
> S_IWUSR: include/uapi/linux/stat.h
> S_IRUGO: include/linux/stat.h

btw: patch 1/4 of the series does remove the uses of
S_ from these macros in sysfs.h and converts
them to simple octal instead.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[-next PATCH 0/4] sysfs and DEVICE_ATTR_

2017-12-19 Thread Joe Perches
Joe Perches (4):
  sysfs.h: Use octal permissions
  treewide: Use DEVICE_ATTR_RW
  treewide: Use DEVICE_ATTR_RO
  treewide: Use DEVICE_ATTR_WO

 arch/arm/mach-pxa/sharpsl_pm.c |  4 +-
 arch/s390/kernel/smp.c |  2 +-
 arch/s390/kernel/topology.c|  3 +-
 arch/sh/drivers/push-switch.c  |  2 +-
 arch/tile/kernel/sysfs.c   | 12 ++--
 arch/x86/kernel/cpu/microcode/core.c   |  2 +-
 drivers/acpi/device_sysfs.c|  6 +-
 drivers/char/ipmi/ipmi_msghandler.c| 17 +++---
 drivers/gpu/drm/i915/i915_sysfs.c  | 12 ++--
 drivers/input/touchscreen/elants_i2c.c |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c |  2 +-
 drivers/net/wimax/i2400m/sysfs.c   |  3 +-
 drivers/nvme/host/core.c   | 10 ++--
 drivers/platform/x86/compal-laptop.c   | 18 ++
 drivers/s390/cio/css.c |  8 +--
 drivers/s390/cio/device.c  | 10 ++--
 drivers/s390/crypto/ap_card.c  |  2 +-
 drivers/scsi/hpsa.c| 10 ++--
 drivers/scsi/lpfc/lpfc_attr.c  | 64 --
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   |  8 +--
 drivers/thermal/thermal_sysfs.c| 17 +++---
 drivers/tty/serial/sh-sci.c|  2 +-
 drivers/usb/host/xhci-dbgcap.c |  2 +-
 drivers/usb/phy/phy-tahvo.c|  2 +-
 drivers/video/fbdev/auo_k190x.c|  4 +-
 drivers/video/fbdev/w100fb.c   |  4 +-
 include/linux/sysfs.h  | 14 ++---
 lib/test_firmware.c| 14 ++---
 lib/test_kmod.c| 14 ++---
 sound/soc/omap/mcbsp.c |  4 +-
 sound/soc/soc-core.c   |  2 +-
 sound/soc/soc-dapm.c   |  2 +-
 32 files changed, 120 insertions(+), 158 deletions(-)

-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW

2017-12-19 Thread Joe Perches
Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.

Done with perl script:

$ git grep -w --name-only DEVICE_ATTR | \
  xargs perl -i -e 'local $/; while (<>) { 
s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*\1_show\s*,\s*\1_store\s*\)/DEVICE_ATTR_RW(\1)/g;
 print;}'

Signed-off-by: Joe Perches <j...@perches.com>
---
 arch/s390/kernel/topology.c  |  3 +--
 arch/tile/kernel/sysfs.c |  2 +-
 drivers/gpu/drm/i915/i915_sysfs.c|  6 ++---
 drivers/platform/x86/compal-laptop.c | 18 +--
 drivers/s390/cio/device.c|  2 +-
 drivers/scsi/lpfc/lpfc_attr.c| 43 
 drivers/thermal/thermal_sysfs.c  |  9 
 drivers/tty/serial/sh-sci.c  |  2 +-
 drivers/usb/host/xhci-dbgcap.c   |  2 +-
 drivers/usb/phy/phy-tahvo.c  |  2 +-
 drivers/video/fbdev/auo_k190x.c  |  4 ++--
 drivers/video/fbdev/w100fb.c |  4 ++--
 lib/test_firmware.c  | 14 +---
 lib/test_kmod.c  | 14 +---
 sound/soc/omap/mcbsp.c   |  4 ++--
 15 files changed, 49 insertions(+), 80 deletions(-)

diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 4d5b65e527b5..4b6e0397f66d 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device *dev,
put_online_cpus();
return rc ? rc : count;
 }
-static DEVICE_ATTR(dispatching, 0644, dispatching_show,
-dispatching_store);
+static DEVICE_ATTR_RW(dispatching);
 
 static ssize_t cpu_polarization_show(struct device *dev,
 struct device_attribute *attr, char *buf)
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
index 825867c53853..af5024f0fb5a 100644
--- a/arch/tile/kernel/sysfs.c
+++ b/arch/tile/kernel/sysfs.c
@@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
return n < 0 ? n : count;
 }
 
-static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
+static DEVICE_ATTR_RW(hv_stats);
 
 static int hv_stats_device_add(struct device *dev, struct subsys_interface 
*sif)
 {
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c 
b/drivers/gpu/drm/i915/i915_sysfs.c
index c74a20b80182..1d0ab8ff5915 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
 
 static DEVICE_ATTR(gt_act_freq_mhz, S_IRUGO, gt_act_freq_mhz_show, NULL);
 static DEVICE_ATTR(gt_cur_freq_mhz, S_IRUGO, gt_cur_freq_mhz_show, NULL);
-static DEVICE_ATTR(gt_boost_freq_mhz, S_IRUGO | S_IWUSR, 
gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
-static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR, gt_max_freq_mhz_show, 
gt_max_freq_mhz_store);
-static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR, gt_min_freq_mhz_show, 
gt_min_freq_mhz_store);
+static DEVICE_ATTR_RW(gt_boost_freq_mhz);
+static DEVICE_ATTR_RW(gt_max_freq_mhz);
+static DEVICE_ATTR_RW(gt_min_freq_mhz);
 
 static DEVICE_ATTR(vlv_rpe_freq_mhz, S_IRUGO, vlv_rpe_freq_mhz_show, NULL);
 
diff --git a/drivers/platform/x86/compal-laptop.c 
b/drivers/platform/x86/compal-laptop.c
index 6bcb750e1865..4f9bc72f0584 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply 
*psy,
 /* == */
 /* Driver Globals */
 /* == */
-static DEVICE_ATTR(wake_up_pme,
-   0644, wake_up_pme_show, wake_up_pme_store);
-static DEVICE_ATTR(wake_up_modem,
-   0644, wake_up_modem_show,   wake_up_modem_store);
-static DEVICE_ATTR(wake_up_lan,
-   0644, wake_up_lan_show, wake_up_lan_store);
-static DEVICE_ATTR(wake_up_wlan,
-   0644, wake_up_wlan_show,wake_up_wlan_store);
-static DEVICE_ATTR(wake_up_key,
-   0644, wake_up_key_show, wake_up_key_store);
-static DEVICE_ATTR(wake_up_mouse,
-   0644, wake_up_mouse_show,   wake_up_mouse_store);
+static DEVICE_ATTR_RW(wake_up_pme);
+static DEVICE_ATTR_RW(wake_up_modem);
+static DEVICE_ATTR_RW(wake_up_lan);
+static DEVICE_ATTR_RW(wake_up_wlan);
+static DEVICE_ATTR_RW(wake_up_key);
+static DEVICE_ATTR_RW(wake_up_mouse);
 
 static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,  NULL);
 static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,  NULL);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 75a245f38e2e..6eefb67b31f3 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev, struct 
device_attribute *attr,
 static DEVICE_ATTR(devtype, 0444, devtype_show, NULL);
 static DEVICE_ATTR(cutype, 0444, cutype_show, NULL);
 static DEVICE_ATTR(modalias, 0444, moda

Re: [PATCH v4 72/73] xfs: Convert mru cache to XArray

2017-12-14 Thread Joe Perches
On Mon, 2017-12-11 at 14:43 -0800, Matthew Wilcox wrote:
>  - There's no warning for the first paragraph of section 6:
> 
> 6) Functions
> 
> 
> Functions should be short and sweet, and do just one thing.  They should
> fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24,
> as we all know), and do one thing and do that well.
> 
>I'm not expecting you to be able to write a perl script that checks
>the first line, but we have way too many 200-plus line functions in
>the kernel.  I'd like a warning on anything over 200 lines (a factor
>of 4 over Linus's stated goal).

Perhaps something like this?

(very very lightly tested, more testing appreciated)
---
 scripts/checkpatch.pl | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4306b7616cdd..523aead40b87 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -59,6 +59,7 @@ my $conststructsfile = "$D/const_structs.checkpatch";
 my $typedefsfile = "";
 my $color = "auto";
 my $allow_c99_comments = 1;
+my $max_function_length = 200;
 
 sub help {
my ($exitcode) = @_;
@@ -2202,6 +2203,7 @@ sub process {
my $realcnt = 0;
my $here = '';
my $context_function;   #undef'd unless there's a known function
+   my $context_function_linenum;
my $in_comment = 0;
my $comment_edge = 0;
my $first_line = 0;
@@ -2341,6 +2343,7 @@ sub process {
} else {
undef $context_function;
}
+   undef $context_function_linenum;
next;
 
 # track the line number as we move through the hunk, note that
@@ -3200,11 +3203,18 @@ sub process {
if ($sline =~ /^\+\{\s*$/ &&
$prevline =~ 
/^\+(?:(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*)?($Ident)\(/) {
$context_function = $1;
+   $context_function_linenum = $realline;
}
 
 # check if this appears to be the end of function declaration
if ($sline =~ /^\+\}\s*$/) {
+   if (defined($context_function_linenum) &&
+   ($realline - $context_function_linenum) > 
$max_function_length) {
+   WARN("LONG_FUNCTION",
+"'$context_function' function definition 
is " . ($realline - $context_function_linenum) . " lines, perhaps refactor\n" . 
$herecurr);
+   }
undef $context_function;
+   undef $context_function_linenum;
}
 
 # check indentation of any line with a bare else
@@ -5983,6 +5993,7 @@ sub process {
defined $stat &&
$stat =~ 
/^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) {
$context_function = $1;
+   $context_function_linenum = $realline;
 
 # check for multiline function definition with misplaced open brace
my $ok = 0;

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 72/73] xfs: Convert mru cache to XArray

2017-12-11 Thread Joe Perches
On Mon, 2017-12-11 at 14:43 -0800, Matthew Wilcox wrote:
> On Mon, Dec 11, 2017 at 02:12:28PM -0800, Joe Perches wrote:
> > Completely reasonable.  Thanks.
> 
> If we're doing "completely reasonable" complaints, then ...
> 
>  - I don't understand why plain 'unsigned' is deemed bad.

That was a David Miller preference.

>  - The rule about all function parameters in prototypes having a name
>doesn't make sense.  Example:
> 
> int ida_get_new_above(struct ida *ida, int starting_id, int *p_id);

Improvements to regex welcomed.

>  - Forcing a blank line after variable declarations sometimes makes for
>some weird-looking code.

True.  I don't care for this one myself.
>Constructively, I think this warning can be suppressed for blocks
>that are under, say, 8 lines.

Not easy to do as checkpatch works on patches.

> 6) Functions
> 
> 
> Functions should be short and sweet, and do just one thing.  They should
> fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24,
> as we all know), and do one thing and do that well.
> 
>I'm not expecting you to be able to write a perl script that checks
>the first line, but we have way too many 200-plus line functions in
>the kernel.  I'd like a warning on anything over 200 lines (a factor
>of 4 over Linus's stated goal).

Maybe reasonable.
Some declaration blocks for things like:

void foo(void)
{
static const struct foobar array[] = {
{ long count of lines... };
[body]
}

might make that warning unreasonable though.

>  - I don't understand the error for xa_head here:
> 
> struct xarray {
> spinlock_t  xa_lock;
> gfp_t   xa_flags;
> void __rcu *xa_head;
> };
> 
>Do people really think that:
> 
> struct xarray {
> spinlock_t  xa_lock;
> gfp_t   xa_flags;
> void __rcu*xa_head;
> };
> 
>is more aesthetically pleasing?  And not just that, but it's an *error*
>so the former is *RIGHT* and this is *WRONG*.  And not just a matter
>of taste?

No opinion really.
That's from Andy Whitcroft's original implementation.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 72/73] xfs: Convert mru cache to XArray

2017-12-11 Thread Joe Perches
On Tue, 2017-12-12 at 08:43 +1100, Dave Chinner wrote:
> On Sat, Dec 09, 2017 at 09:00:18AM -0800, Joe Perches wrote:
> > On Sat, 2017-12-09 at 09:36 +1100, Dave Chinner wrote:
> > >   1. Using lockdep_set_novalidate_class() for anything other
> > >   than device->mutex will throw checkpatch warnings. Nice. (*)
> > []
> > > (*) checkpatch.pl is considered mostly harmful round here, too,
> > > but that's another rant
> > 
> > How so?
> 
> Short story is that it barfs all over the slightly non-standard
> coding style used in XFS.
[]
> This sort of stuff is just lowest-common-denominator noise - great
> for new code and/or inexperienced developers, but not for working
> with large bodies of existing code with slightly non-standard
> conventions.

Completely reasonable.  Thanks.

Do you get many checkpatch submitters for fs/xfs?

If so, could probably do something about adding
a checkpatch file flag to the directory or equivalent.

Maybe add something like:

fs/xfs/.checkpatch

where the contents turn off most everything
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 72/73] xfs: Convert mru cache to XArray

2017-12-09 Thread Joe Perches
On Sat, 2017-12-09 at 09:36 +1100, Dave Chinner wrote:
>   1. Using lockdep_set_novalidate_class() for anything other
>   than device->mutex will throw checkpatch warnings. Nice. (*)
[]
> (*) checkpatch.pl is considered mostly harmful round here, too,
> but that's another rant

How so?

> (**) the frequent occurrence of "core code/devs aren't held to the
> same rules/standard as everyone else" is another rant I have stored
> up for a rainy day.

Yeah.  I wouldn't mind reading that one...

Rainy season is starting right about now here too.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] usb: dwc2: Remove unnecessary debug prints

2017-12-07 Thread Joe Perches
On Thu, 2017-12-07 at 11:17 -0800, Joe Perches wrote:
> On Wed, 2017-12-06 at 17:57 +0400, Razmik Karapetyan wrote:
> > Removed unnecessary debug prints about DMA mode for host side
> > from dwc2_gahbcfg_init() function.
> 
> What other functionality makes these unnecessary?
> If any, it's nice to de

... describe it in the changelog.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] usb: dwc2: Remove unnecessary debug prints

2017-12-07 Thread Joe Perches
On Wed, 2017-12-06 at 17:57 +0400, Razmik Karapetyan wrote:
> Removed unnecessary debug prints about DMA mode for host side
> from dwc2_gahbcfg_init() function.

What other functionality makes these unnecessary?
If any, it's nice to de
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()

2017-12-07 Thread Joe Perches
On Thu, 2017-12-07 at 10:12 -0500, Alan Stern wrote:
> The real problem is that the kernel development community doesn't have
> a fixed policy on how to handle memory allocation errors.
[]
> If there was one agreed-upon policy, then we could definitively point 
> to old code and say "That's wrong, and here is how it should be fixed."  
> But currently this is not possible, and we end up with repetitive 
> discussions like this one that aren't of general use.

Well stated.

My preferred policy would be to remove all the individual
allocation failure messages and only use the generic
warn_alloc()/dump_stack() mechanism.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] USB: hub: Delete an error message for a failed memory allocation in usb_hub_clear_tt_buffer()

2017-12-06 Thread Joe Perches
On Wed, 2017-12-06 at 11:45 -0500, Alan Stern wrote:
> On Wed, 6 Dec 2017, SF Markus Elfring wrote:
> > Omit an extra message for a memory allocation failure in this function.

Markus' typical terrible commit message.

> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
[]
> > @@ -829,7 +829,6 @@ int usb_hub_clear_tt_buffer(struct urb *urb)
> >*/
> >   clear = kmalloc(sizeof *clear, GFP_ATOMIC);
> >   if (clear == NULL) {
> > - dev_err(>dev, "can't save CLEAR_TT_BUFFER state\n");
> >   /* FIXME recover somehow ... RESET_TT? */
> >   return -ENOMEM;
> >   }
> 
> Does the existing memory allocation error message include the 
> >dev device name and driver name?  If it doesn't, there will be 
> no way for the user to tell that the error message is related to the 
> device failure.

No, but the effect is similar.

OOM does a dump_stack() so this function's call tree is shown.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: core: Fix logging messages with spurious periods after newlines

2017-12-05 Thread Joe Perches
On Wed, 2017-12-06 at 07:27 +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 05, 2017 at 10:22:05PM -0800, Joe Perches wrote:
> > Using a period after a newline causes bad output.
> 
> Nice catch, how did you find that?

$ git grep '\\n\."'

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: core: Fix logging messages with spurious periods after newlines

2017-12-05 Thread Joe Perches
Using a period after a newline causes bad output.

Miscellanea:

o Coalesce formats too

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/usb/core/driver.c  |  8 
 drivers/usb/core/hub.c | 17 +++--
 drivers/usb/core/message.c |  6 +++---
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 64262a9a8829..d8d7377b5fb8 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -342,8 +342,8 @@ static int usb_probe_interface(struct device *dev)
if (driver->disable_hub_initiated_lpm) {
lpm_disable_error = usb_unlocked_disable_lpm(udev);
if (lpm_disable_error) {
-   dev_err(>dev, "%s Failed to disable LPM for 
driver %s\n.",
-   __func__, driver->name);
+   dev_err(>dev, "%s Failed to disable LPM for 
driver %s\n",
+   __func__, driver->name);
error = lpm_disable_error;
goto err;
}
@@ -537,8 +537,8 @@ int usb_driver_claim_interface(struct usb_driver *driver,
if (driver->disable_hub_initiated_lpm) {
lpm_disable_error = usb_unlocked_disable_lpm(udev);
if (lpm_disable_error) {
-   dev_err(>dev, "%s Failed to disable LPM for 
driver %s\n.",
-   __func__, driver->name);
+   dev_err(>dev, "%s Failed to disable LPM for 
driver %s\n",
+   __func__, driver->name);
return -ENOMEM;
}
}
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index cf7bbcb9a63c..b95855076f43 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1049,12 +1049,10 @@ static void hub_activate(struct usb_hub *hub, enum 
hub_activation_type type)
ret = hcd->driver->update_hub_device(hcd, hdev,
>tt, GFP_NOIO);
if (ret < 0) {
-   dev_err(hub->intfdev, "Host not "
-   "accepting hub info "
-   "update.\n");
-   dev_err(hub->intfdev, "LS/FS devices "
-   "and hubs may not work "
-   "under this hub\n.");
+   dev_err(hub->intfdev,
+   "Host not accepting hub info 
update\n");
+   dev_err(hub->intfdev,
+   "LS/FS devices and hubs may not 
work under this hub\n");
}
}
hub_power_on(hub, true);
@@ -3157,7 +3155,7 @@ int usb_port_suspend(struct usb_device *udev, 
pm_message_t msg)
usb_set_usb2_hardware_lpm(udev, 0);
 
if (usb_disable_ltm(udev)) {
-   dev_err(>dev, "Failed to disable LTM before suspend\n.");
+   dev_err(>dev, "Failed to disable LTM before suspend\n");
status = -ENOMEM;
if (PMSG_IS_AUTO(msg))
goto err_ltm;
@@ -5484,13 +5482,12 @@ static int usb_reset_and_verify_device(struct 
usb_device *udev)
 */
ret = usb_unlocked_disable_lpm(udev);
if (ret) {
-   dev_err(>dev, "%s Failed to disable LPM\n.", __func__);
+   dev_err(>dev, "%s Failed to disable LPM\n", __func__);
goto re_enumerate_no_bos;
}
ret = usb_disable_ltm(udev);
if (ret) {
-   dev_err(>dev, "%s Failed to disable LTM\n.",
-   __func__);
+   dev_err(>dev, "%s Failed to disable LTM\n", __func__);
goto re_enumerate_no_bos;
}
 
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index f836bae1e485..dac4adeec213 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1356,7 +1356,7 @@ int usb_set_interface(struct usb_device *dev, int 
interface, int alternate)
 * so that the xHCI driver can recalculate the U1/U2 timeouts.
 */
if (usb_disable_lpm(dev)) {
-   dev_err(>dev, "%s Failed to disable LPM\n.", __func__);
+   dev_err(>dev, "%s Failed to disable LPM\n", __func__);
mutex_unlock(hcd->ban

Re: [PATCH] net: usb: hso.c: remove unneeded DRIVER_LICENSE #define

2017-11-23 Thread Joe Perches
On Thu, 2017-11-23 at 15:30 -0800, Joe Perches wrote:
> --- /dev/null 2017-11-23 06:19:12.943046739 -0800
> +++ single_use_module.pl  2017-11-23 15:23:11.729812156 -0800
> @@ -0,0 +1,15 @@
[]
> +$data =~ s~$var~$string~;

this needs to be:

$data =~ s~\b$var\b~$string~;
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: usb: hso.c: remove unneeded DRIVER_LICENSE #define

2017-11-23 Thread Joe Perches
On Wed, 2017-11-22 at 18:12 +0100, Greg Kroah-Hartman wrote:
> On Wed, Nov 22, 2017 at 09:05:36AM -0800, Joe Perches wrote:
> > On Fri, 2017-11-17 at 15:19 +0100, Greg Kroah-Hartman wrote:
> > > There is no need to #define the license of the driver, just put it in
> > > the MODULE_LICENSE() line directly as a text string.
> > > 
> > > This allows tools that check that the module license matches the source
> > > code license to work properly, as there is no need to unwind the
> > > unneeded dereference.
> > 
> > []
> > > diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> > 
> > []
> > > @@ -76,7 +76,6 @@
> > >  
> > >  #define MOD_AUTHOR   "Option Wireless"
> > >  #define MOD_DESCRIPTION  "USB High Speed Option driver"
> > > -#define MOD_LICENSE  "GPL"
> > >  
> > >  #define HSO_MAX_NET_DEVICES  10
> > >  #define HSO__MAX_MTU 2048
> > > @@ -3288,7 +3287,7 @@ module_exit(hso_exit);
> > >  
> > >  MODULE_AUTHOR(MOD_AUTHOR);
> > >  MODULE_DESCRIPTION(MOD_DESCRIPTION);
> > > -MODULE_LICENSE(MOD_LICENSE);
> > > +MODULE_LICENSE("GPL");
> > 
> > Probably all of these MODULE_(MOD_) uses could be
> > simplified as well.
> 
> Agreed, I did that for a bunch of USB drivers, need to do it for others
> as well.

Here's a little perl and bash script that seems to do the right thing
---
--- /dev/null   2017-11-23 06:19:12.943046739 -0800
+++ single_use_module.pl2017-11-23 15:23:11.729812156 -0800
@@ -0,0 +1,15 @@
+$/ = undef;
+my $var = $ARGV[0];
+my $file = $ARGV[1];
+print("var: <$var> file: <$file>\n");
+open my $fh, "<", $file or die;
+my $data = <$fh>;
+close $fh;
+$data =~ s/\n#[ \t]*define\s+$var\s+(.*)\n/\n/;
+my $string = $1;
+print("string: <$string>\n");
+$string =~ s/\s+\n//;
+$data =~ s~$var~$string~;
+open my $fh, ">", $file or die;
+print $fh $data;
+close $fh;

--- /dev/null   2017-11-23 06:19:12.943046739 -0800
+++ single_use_module.bash  2017-11-23 15:23:01.964676948 -0800
@@ -0,0 +1,25 @@
+#!/bin/bash
+git grep -P '\bMODULE_[A-Z]+\s*\(\s*[A-Z_]+\s*\)' $@ |
+while read line ; do
+   file=$(echo $line | cut -f1 -d":")
+   define=$(echo $line | cut -f2- -d":")
+   var=$(echo $define | sed -r -e 's/^MODULE_[A-Z_]+\s*\(\s*//' -r -e 
's/^([A-Z_]+).*$/\1/')
+
+   # see if the define exists in the file
+   count1=$(git grep -c -P "^\s*#\s*define\s+$var\s+" $file | cut -f2- 
-d":")
+   if [[ $count1 != 1 ]] ; then
+   continue
+   fi
+
+   # see if the var exists twice (once in the #define, once in the use)
+   count2=$(git grep -c -P -w $var $file | cut -f2- -d":")
+   if [[ $count2 != 2 ]] ; then
+   continue
+   fi
+
+   if [[ "${defline: -1}" == "\\" ]] ; then
+   continue
+   fi
+
+   perl single_use_module.pl $var $file
+done

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: usb: hso.c: remove unneeded DRIVER_LICENSE #define

2017-11-22 Thread Joe Perches
On Fri, 2017-11-17 at 15:19 +0100, Greg Kroah-Hartman wrote:
> There is no need to #define the license of the driver, just put it in
> the MODULE_LICENSE() line directly as a text string.
> 
> This allows tools that check that the module license matches the source
> code license to work properly, as there is no need to unwind the
> unneeded dereference.
[]
> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
[]
> @@ -76,7 +76,6 @@
>  
>  #define MOD_AUTHOR   "Option Wireless"
>  #define MOD_DESCRIPTION  "USB High Speed Option driver"
> -#define MOD_LICENSE  "GPL"
>  
>  #define HSO_MAX_NET_DEVICES  10
>  #define HSO__MAX_MTU 2048
> @@ -3288,7 +3287,7 @@ module_exit(hso_exit);
>  
>  MODULE_AUTHOR(MOD_AUTHOR);
>  MODULE_DESCRIPTION(MOD_DESCRIPTION);
> -MODULE_LICENSE(MOD_LICENSE);
> +MODULE_LICENSE("GPL");

Probably all of these MODULE_(MOD_) uses could be
simplified as well.

Perhaps there's utility in a (cocci?) script that looks for
used-once
macro #defines in various types of macros.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] typec: tcpm: Move out of staging

2017-09-10 Thread Joe Perches
On Sun, 2017-09-10 at 13:37 -0700, Guenter Roeck wrote:
> Move tcpm (USB Type-C Port Manager) out of staging.

git format-patch -M

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] [media] zr364xx: Fix a typo in a comment line of the file header

2017-08-29 Thread Joe Perches
On Tue, 2017-08-29 at 07:35 +0200, SF Markus Elfring wrote:
> From: Markus Elfring 
> Date: Mon, 28 Aug 2017 22:46:30 +0200
> 
> Fix a word in this description.
> 
> Signed-off-by: Markus Elfring 
> ---
>  drivers/media/usb/zr364xx/zr364xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/zr364xx/zr364xx.c 
> b/drivers/media/usb/zr364xx/zr364xx.c
> index 4cc6d2a9d91f..4ccf71d8b608 100644
> --- a/drivers/media/usb/zr364xx/zr364xx.c
> +++ b/drivers/media/usb/zr364xx/zr364xx.c
> @@ -2,7 +2,7 @@
>   * Zoran 364xx based USB webcam module version 0.73
>   *
>   * Allows you to use your USB webcam with V4L2 applications
> - * This is still in heavy developpement !
> + * This is still in heavy development!

There is almost no development being done here.
Just delete the line.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/18] treewide: Move storage class before return type

2017-07-05 Thread Joe Perches
Move the inline/asmlinkage keywords before the return types
Add a checkpatch test for this too.

Joe Perches (18):
  checkpatch: improve the STORAGE_CLASS test
  ARM: KVM: Move asmlinkage before type
  ARM: HP Jornada 7XX: Move inline before return type
  CRIS: gpio: Move inline before return type
  FRV: tlbflush: Move asmlinkage before return type
  ia64: Move inline before return type
  ia64: sn: pci: Move inline before type
  m68k: coldfire: Move inline before return type
  MIPS: SMP: Move asmlinkage before return type
  sh: Move inline before return type
  x86/efi: Move asmlinkage before return type
  drivers: s390: Move static and inline before return type
  drivers: tty: serial: Move inline before return type
  USB: serial: safe_serial: Move __inline__ before return type
  video: fbdev: intelfb: Move inline before return type
  video: fbdev: omap: Move inline before return type
  ARM: samsung: usb-ohci: Move inline before return type
  ALSA: opl4: Move inline before return type

 arch/arm/include/asm/kvm_hyp.h |  8 
 arch/arm/mach-sa1100/jornada720_ssp.c  |  2 +-
 arch/cris/arch-v10/drivers/gpio.c  |  4 ++--
 arch/frv/include/asm/tlbflush.h|  8 
 arch/ia64/kernel/mca.c |  2 +-
 arch/ia64/sn/pci/pcibr/pcibr_ate.c |  2 +-
 arch/ia64/sn/pci/tioce_provider.c  |  4 ++--
 arch/m68k/coldfire/intc-simr.c |  4 ++--
 arch/mips/include/asm/smp.h|  2 +-
 arch/sh/mm/cache-sh5.c |  2 +-
 arch/x86/include/asm/efi.h |  4 ++--
 drivers/s390/net/ctcm_main.c   |  2 +-
 drivers/s390/net/qeth_l3_main.c|  2 +-
 drivers/tty/serial/ioc3_serial.c   |  4 ++--
 drivers/tty/serial/ioc4_serial.c   |  4 ++--
 drivers/usb/serial/safe_serial.c   |  2 +-
 drivers/video/fbdev/intelfb/intelfbdrv.c   |  2 +-
 drivers/video/fbdev/omap/lcdc.c|  6 +++---
 include/linux/platform_data/usb-ohci-s3c2410.h |  2 +-
 scripts/checkpatch.pl  | 12 ++--
 sound/drivers/opl4/opl4_lib.c  |  2 +-
 21 files changed, 44 insertions(+), 36 deletions(-)

-- 
2.10.0.rc2.1.g053435c

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/18] USB: serial: safe_serial: Move __inline__ before return type

2017-07-05 Thread Joe Perches
Make the code like the rest of the kernel.
Also use inline instead of __inline__.

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/usb/serial/safe_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index 8a069aa154ed..27d7a7016298 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -180,7 +180,7 @@ static const __u16 crc10_table[256] = {
  * Perform a memcpy and calculate fcs using ppp 10bit CRC algorithm. Return
  * new 10 bit FCS.
  */
-static __u16 __inline__ fcs_compute10(unsigned char *sp, int len, __u16 fcs)
+static inline __u16 fcs_compute10(unsigned char *sp, int len, __u16 fcs)
 {
for (; len-- > 0; fcs = CRC10_FCS(fcs, *sp++));
return fcs;
-- 
2.10.0.rc2.1.g053435c

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 5/8] PM / sleep: Print timing information if debug is enabled

2017-06-12 Thread Joe Perches
On Mon, 2017-06-12 at 22:51 +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki 
> 
> Avoid printing the device suspend/resume timing information if
> CONFIG_PM_DEBUG is not set to reduce the log noise level.
> 
> Signed-off-by: Rafael J. Wysocki 
> ---
>  drivers/base/power/main.c |4 
>  1 file changed, 4 insertions(+)
> 
> Index: linux-pm/drivers/base/power/main.c
> ===
> --- linux-pm.orig/drivers/base/power/main.c
> +++ linux-pm/drivers/base/power/main.c
> @@ -417,6 +417,7 @@ static void pm_dev_err(struct device *de
>   dev_name(dev), pm_verb(state.event), info, error);
>  }
>  
> +#ifdef CONFIG_PM_DEBUG
>  static void dpm_show_time(ktime_t starttime, pm_message_t state, char *info)
>  {
>   ktime_t calltime;
> @@ -433,6 +434,9 @@ static void dpm_show_time(ktime_t startt
>   info ?: "", info ? " " : "", pm_verb(state.event),
>   usecs / USEC_PER_MSEC, usecs % USEC_PER_MSEC);
>  }
> +#else
> +static inline void dpm_show_time(ktime_t starttime, pm_message_t state, char 
> *info) {}
> +#endif /* CONFIG_PM_DEBUG */
>  
>  static int dpm_run_callback(pm_callback_t cb, struct device *dev,
>   pm_message_t state, char *info)
> 

trivia:

This style of code can be reduced a few lines of code
using a single definition.

static type func(args...)
{
#ifdef CONFIG_
[code ...]
#endif
}

and compilers will generate the same code for the
!defined CONFIG_ case.

This style can help avoid defects of updating one
function definition and not the other and only
compile testing the updated version.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 05/10] usb: musb: tusb6010_omap: Do not reset the other direction's packet size

2017-05-10 Thread Joe Perches
On Wed, 2017-05-10 at 12:07 -0500, Bin Liu wrote:
> On Wed, May 10, 2017 at 11:42:27AM +0300, Peter Ujfalusi wrote:
> > We have one register for each EP to set the maximum packet size for both
> > TX and RX.
> > If for example an RX programming would happen before the previous TX
> > transfer finishes we would reset the TX packet side.
> > 
> > To fix this issue, only modify the TX or RX part of the register.
[]
> > diff --git a/drivers/usb/musb/tusb6010_omap.c 
> > b/drivers/usb/musb/tusb6010_omap.c
[]
> > @@ -389,15 +389,19 @@ static int tusb_omap_dma_program(struct dma_channel 
> > *channel, u16 packet_sz,
> >  
> > if (chdat->tx) {
> > /* Send transfer_packet_sz packets at a time */
> > -   musb_writel(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET,
> > -   chdat->transfer_packet_sz);
> > +   u32 psize = musb_readl(ep_conf, TUSB_EP_MAX_PACKET_SIZE_OFFSET);
> 
> checkpatch.pl complains about declaration and assignment together.

No it doesn't.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] usb: dwc2: Remove unnecessary debug prints

2017-04-19 Thread Joe Perches
On Wed, 2017-04-19 at 15:16 +0400, Razmik Karapetyan wrote:
> Removed unnecessary debug prints about DMA mode for host side
> from dwc2_gahbcfg_init() function.

Why are these unnecessary?  Are these emitted elsewhere?

and...

> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
[]
> @@ -302,22 +302,10 @@ static int dwc2_gahbcfg_init(struct dwc2_hsotg *hsotg)
[]
>   if (hsotg->params.host_dma)
>   ahbcfg |= GAHBCFG_DMA_EN;
> + else
> + hsotg->params.dma_desc_enable = false;

This change isn't mentioned in the commit message.
Why is is useful?
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Patch for drivers/usb/serial/ch341.c enabling parity

2017-04-02 Thread Joe Perches
On Sun, 2017-04-02 at 18:57 +0200, Leif Neland wrote:
> There is a patch
> https://github.com/karlp/ch341-linux/blob/master/0001-usb-serial-ch341-Add-parity-support.patch
> which enables parity selection for the ch341 USB-RS485 adapter.
> 
> From: Karl Palsson  Date: Tue, 18 Mar 2014 23:33:27
> +
> 
> This adapter is available for cheap on eBay.
> 
> The patch made me able to use this adapter for polling my modbus
> power-meter with raspberry pi.
> 
> Would it be possible to get this into the official distribution?
> 
> Leif Neland

You should really ask the usb serial maintainer.

There's a tool, scripts/get_maintainer.pl, that can
tell you who you ask about who is responsible for
various bits of the kernel.

$ ./scripts/get_maintainer.pl -f drivers/usb/serial/ch341.c
Johan Hovold  (maintainer:USB SERIAL SUBSYSTEM)
Greg Kroah-Hartman  (supporter:USB SUBSYSTEM)
linux-usb@vger.kernel.org (open list:USB SERIAL SUBSYSTEM)
linux-ker...@vger.kernel.org (open list)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] HID: usbhid: Use pr_ and remove unnecessary OOM messages

2017-03-01 Thread Joe Perches
Use a more common logging style and remove the unnecessary
OOM messages as there is default dump_stack when OOM.

Miscellanea:

o Hoist an assignment in an if
o Realign arguments
o Realign a deeply indented if descendent above a printk

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/hid/usbhid/hid-core.c   | 16 +++-
 drivers/hid/usbhid/hid-quirks.c | 11 ---
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 961bc6fdd2d9..cd98db6cf94f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1004,10 +1004,9 @@ static int usbhid_parse(struct hid_device *hid)
return -EINVAL;
}
 
-   if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) {
-   dbg_hid("couldn't allocate rdesc memory\n");
+   rdesc = kmalloc(rsize, GFP_KERNEL);
+   if (!rdesc)
return -ENOMEM;
-   }
 
hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0);
 
@@ -1077,8 +1076,8 @@ static int usbhid_start(struct hid_device *hid)
if (hid->quirks & HID_QUIRK_FULLSPEED_INTERVAL &&
dev->speed == USB_SPEED_HIGH) {
interval = fls(endpoint->bInterval*8);
-   printk(KERN_INFO "%s: Fixing fullspeed to highspeed 
interval: %d -> %d\n",
-  hid->name, endpoint->bInterval, interval);
+   pr_info("%s: Fixing fullspeed to highspeed interval: %d 
-> %d\n",
+   hid->name, endpoint->bInterval, interval);
}
 
/* Change the polling interval of mice. */
@@ -1456,10 +1455,9 @@ static int hid_post_reset(struct usb_interface *intf)
 * the size of the HID report descriptor has not changed.
 */
rdesc = kmalloc(hid->dev_rsize, GFP_KERNEL);
-   if (!rdesc) {
-   dbg_hid("couldn't allocate rdesc memory (post_reset)\n");
+   if (!rdesc)
return -ENOMEM;
-   }
+
status = hid_get_class_descriptor(dev,
interface->desc.bInterfaceNumber,
HID_DT_REPORT, rdesc, hid->dev_rsize);
@@ -1637,7 +1635,7 @@ static int __init hid_init(void)
retval = usb_register(_driver);
if (retval)
goto usb_register_fail;
-   printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
+   pr_info(KBUILD_MODNAME ": " DRIVER_DESC "\n");
 
return 0;
 usb_register_fail:
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index d6847a664446..9287ab03e117 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -237,10 +237,8 @@ static int usbhid_modify_dquirk(const u16 idVendor, const 
u16 idProduct,
}
 
q_new = kmalloc(sizeof(struct quirks_list_struct), GFP_KERNEL);
-   if (!q_new) {
-   dbg_hid("Could not allocate quirks_list_struct\n");
+   if (!q_new)
return -ENOMEM;
-   }
 
q_new->hid_bl_item.idVendor = idVendor;
q_new->hid_bl_item.idProduct = idProduct;
@@ -306,10 +304,9 @@ int usbhid_quirks_init(char **quirks_param)
, , );
 
if (m != 3 ||
-   usbhid_modify_dquirk(idVendor, idProduct, 
quirks) != 0) {
-   printk(KERN_WARNING
-   "Could not parse HID quirk module param 
%s\n",
-   quirks_param[n]);
+   usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) {
+   pr_warn("Could not parse HID quirk module param %s\n",
+   quirks_param[n]);
}
}
 
-- 
2.10.0.rc2.1.g053435c

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hid: usbhid: usbkbd: fix checkpatch.pl issues

2017-03-01 Thread Joe Perches
On Wed, 2017-03-01 at 21:59 +0200, Avraham Shukron wrote:
> > 
> > This kind of change is definitely not helpful. The original table was
> > Nx16, you converted it to Nx14. Why do you think original table used 16
> > columns?
> > 
> > Regardless, it's a very old driver, just let it be.
> > 
> > Thanks.
> > 
> 
> I can make it Nx8 :)
> 
> Seriously now - I don't understand what is so wrong with checkpatch fixes?

Some say is makes following logical changes more difficult.
git blame, etc...  I'm not a big adherent of that though.

> I'm a new to kernel development, and the natural place to start is to do some
> coding style fixes.
> I thought fixing a driver that I actually use daily will be more satisfying.
> Why driver being old is a good reason to ignore the coding style conventions?

The space after comma rule _should_ be broken when
alignment is more obvious.  The existing code is just fine.

Conventions are just that.  It's OK to be unconventional.

It's better to know when to follow and when not to follow
those conventions.

checkpatch messages should be considered guides and not
dicta that must be followed to the last letter.

To me, the rest of the patch was OK though.

If you want to learn the kernel patch process, modifying files
in drivers/staging is a good place to start.

Otherwise, it's probably best to find/fix some actual defect
and suggest actual logical changes that reduce code size,
improve performance, expand test coverage, better document
the code, etc..

cheers, Joe
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/19] Replace PCI pool by DMA pool API

2017-03-01 Thread Joe Perches
On Wed, 2017-03-01 at 16:55 +0100, Romain Perier wrote:
> support to warn about this old API in checkpath.pl

checkpatch

This part isn't true anymore, but it seems sensible enough, thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API

2017-02-27 Thread Joe Perches
On Mon, 2017-02-27 at 13:52 +0100, Romain Perier wrote:

> > I also wonder if you've in fact converted all of the
> > pci_pool struct and function uses why a new checkpatch
> > test is needed at all.
> 
> That's just to avoid futures mistakes/uses.

When all instances and macro definitions are removed
the check is pointless as any newly submitted patch
will not compile.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API

2017-02-27 Thread Joe Perches
On Mon, 2017-02-27 at 13:26 +0100, Romain Perier wrote:
> Hello,
> 
> 
> Le 27/02/2017 à 12:22, Peter Senna Tschudin a écrit :
> > On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
> > > pci_pool_*() functions should be replaced by the corresponding functions
> > > in the DMA pool API. This adds support to check for use of these pci
> > > functions and display a warning when it is the case.
> > > 
> > 
> > I guess Joe Perches did sent some comments for this one, did you address
> > them?
> 
> See the changelog of 00/20 (for v2). I have already integrated his
> comments :)

Not quite.  You need to add blank lines before and after
the new test you added.

I also wonder if you've in fact converted all of the
pci_pool struct and function uses why a new checkpatch
test is needed at all.

Also, it seems none of these patches have reached lkml.
Are you sending the patch series with MIME/html parts?  

> > Reviewed-by: Peter Senna Tschudin <peter.se...@collabora.com>
> > > Signed-off-by: Romain Perier <romain.per...@collabora.com>
> > > ---
> > >  scripts/checkpatch.pl | 9 -
> > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > index baa3c7b..f2c775c 100755
> > > --- a/scripts/checkpatch.pl
> > > +++ b/scripts/checkpatch.pl
> > > @@ -6064,7 +6064,14 @@ sub process {
> > >   WARN("USE_DEVICE_INITCALL",
> > >"please use device_initcall() or more appropriate 
> > > function instead of __initcall() (see include/linux/init.h)\n" . 
> > > $herecurr);
> > >   }
> > > -
> > > +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
> > > + if ($line =~ 
> > > /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
> > > + if (WARN("USE_DMA_POOL",
> > > +  "please use the dma pool api or more 
> > > appropriate function instead of the old pci pool api\n" . $herecurr) &&
> > > + $fix) {
> > > + while ($fixed[$fixlinenr] =~ 
> > > s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
> > > + }
> > > + }
> > >  # check for various structs that are normally const (ops, kgdb, 
> > > device_tree)
> > >   if ($line !~ /\bconst\b/ &&
> > >   $line =~ /\bstruct\s+($const_structs)\b/) {
> > > -- 
> > > 2.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 20/20] checkpatch: warn for use of old PCI pool API

2017-02-27 Thread Joe Perches
On Mon, 2017-02-27 at 12:22 +0100, Peter Senna Tschudin wrote:
> On Sun, Feb 26, 2017 at 08:24:25PM +0100, Romain Perier wrote:
> > pci_pool_*() functions should be replaced by the corresponding functions
> > in the DMA pool API. This adds support to check for use of these pci
> > functions and display a warning when it is the case.
> > 
> 
> I guess Joe Perches did sent some comments for this one, did you address
> them?


> Reviewed-by: Peter Senna Tschudin <peter.se...@collabora.com>
> > Signed-off-by: Romain Perier <romain.per...@collabora.com>
> > ---
> >  scripts/checkpatch.pl | 9 -
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index baa3c7b..f2c775c 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -6064,7 +6064,14 @@ sub process {
> > WARN("USE_DEVICE_INITCALL",
> >  "please use device_initcall() or more appropriate 
> > function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
> > }
> > -
> > +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
> > +   if ($line =~ 
> > /\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
> > +   if (WARN("USE_DMA_POOL",
> > +"please use the dma pool api or more 
> > appropriate function instead of the old pci pool api\n" . $herecurr) &&
> > +   $fix) {
> > +   while ($fixed[$fixlinenr] =~ 
> > s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
> > +   }
> > +   }
> >  # check for various structs that are normally const (ops, kgdb, 
> > device_tree)
> > if ($line !~ /\bconst\b/ &&
> > $line =~ /\bstruct\s+($const_structs)\b/) {
> > 

This is nearly identical to the suggestion that I
sent but this is slightly misformatted as it does
not have a leading nor a trailing blank line to
separate the test blocks.

Also, I think none of the patches have reached lkml.

Romain, are you using git-send-email to send these
patches?  Perhaps the patches you send also contain
html which are rejected by the mailing list.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 19/19] checkpatch: warn for use of old PCI pool API

2017-02-08 Thread Joe Perches
On Wed, 2017-02-08 at 19:55 +0100, Peter Senna Tschudin wrote:
> On Wed, Feb 08, 2017 at 05:34:57PM +0100, Romain Perier wrote:
> > pci_pool_*() functions should be replaced by the corresponding functions
> > in the DMA pool API. This adds support to check for use of these pci
> > functions and display a warning when it is the case.
> 
> Don't know if relevant, but did not catch the struct. Other than that
> works fine.
> 
> > 
> > Signed-off-by: Romain Perier 
> > ---
> >  scripts/checkpatch.pl | 5 +
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 8e96af5..026920e 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -6058,6 +6058,11 @@ sub process {
> > WARN("USE_DEVICE_INITCALL",
> >  "please use device_initcall() or more appropriate 
> > function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
> > }
> > +# check for old PCI api pci_pool_*(), use dma_pool_*() instead
> > +   if ($line =~ /\bpci_pool_.+\(/) {
> > +   WARN("USE_PCI_POOL",
> > +"please use the dma pool api or more appropriate 
> > function instead of the old pci pool api\n" . $herecurr);
> > +   }
> >  
> >  # check for various structs that are normally const (ops, kgdb, 
> > device_tree)
> > if ($line !~ /\bconst\b/ &&
> > -- 
> > 2.9.3
> > 

Did this patch get to lkml?

Perhaps this would be more complete:

 scripts/checkpatch.pl | 9 +
 1 file changed, 9 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8e96af53611c..600f81cc1ec1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6059,6 +6059,15 @@ sub process {
     "please use device_initcall() or more appropriate 
function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
    }
 
+# check for old PCI api pci_pool_*(), use dma_pool_*() instead
+   if ($line =~ 
/\bpci_pool(?:_(?:create|destroy|alloc|zalloc|free)|)\b/) {
+   if (WARN("USE_DMA_POOL",
+    "please use the dma pool api or more 
appropriate function instead of the old pci pool api\n" . $herecurr) &&
+   $fix) {
+   while ($fixed[$fixlinenr] =~ 
s/\bpci_pool(_(?:create|destroy|alloc|zalloc|free)|)\b/dma_pool$1/) {}
+   }
+   }
+
 # check for various structs that are normally const (ops, kgdb, device_tree)
    if ($line !~ /\bconst\b/ &&
    $line =~ /\bstruct\s+($const_structs)\b/) {

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH v3 1/2] usb: typec: USB Type-C Port Manager (tcpm)

2016-09-30 Thread Joe Perches
On Fri, 2016-09-30 at 12:06 -0700, Guenter Roeck wrote:
> On Thu, Sep 29, 2016 at 11:37 PM, Jun Li  wrote:
[]
> > diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h
[]
> > +#define PDO_VAR(min_mv, max_mv, max_ma)
> >   \
> > + ((PDO_TYPE_VAR << PDO_TYPE_SHIFT) | \
> > +  min_mv) / 50) & PDO_VAR_MIN_VOLT_MASK) <<  \
> > +   PDO_VAR_MIN_VOLT_SHIFT) | \
> > +  max_mv) / 50) & PDO_VAR_MAX_VOLT_MASK) <<  \
> > +   PDO_VAR_MAX_VOLT_SHIFT) | \
> > +  max_ma) / 50) & PDO_VAR_MAX_CURR_MASK) <<  \
> 
> 
> max_ma) / 10) & PDO_VAR_MAX_CURR_MASK) <<  \

This would be easier to read if laid out differently.

#define PDO_VAR(min_mv, max_mv, max_ma) 
\
((PDO_TYPE_VAR << PDO_TYPE_SHIFT) | 
\
 min_mv) / 50) & PDO_VAR_MIN_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT) 
|\
 max_mv) / 50) & PDO_VAR_MAX_VOLT_MASK) << PDO_VAR_MAX_VOLT_SHIFT) 
|\
 max_ma) / 10) & PDO_VAR_MAX_CURR_MASK) << PDO_VAR_MAX_CURR_SHIFT))

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: Convert pr_warning to pr_warn

2016-09-27 Thread Joe Perches
Use the more common logging mechanism.

Miscellanea:

o Realign multiline statements
o Coalesce format

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/usb/gadget/function/rndis.c |  9 -
 drivers/usb/gadget/function/u_serial.c  |  4 ++--
 drivers/usb/gadget/udc/at91_udc.h   |  2 +-
 drivers/usb/gadget/udc/atmel_usba_udc.c |  4 ++--
 drivers/usb/gadget/udc/fsl_usb2_udc.h   |  2 +-
 drivers/usb/gadget/udc/m66592-udc.c |  4 ++--
 drivers/usb/gadget/udc/omap_udc.h   |  2 +-
 drivers/usb/gadget/udc/pxa25x_udc.h |  2 +-
 drivers/usb/host/isp1362-hcd.c  | 27 ++-
 drivers/usb/isp1760/isp1760-if.c|  2 +-
 10 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/usb/gadget/function/rndis.c 
b/drivers/usb/gadget/function/rndis.c
index ab6ac1b74ac0..766c328c15c0 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -474,8 +474,7 @@ static int gen_ndis_query_resp(struct rndis_params *params, 
u32 OID, u8 *buf,
break;
 
default:
-   pr_warning("%s: query unknown OID 0x%08X\n",
-__func__, OID);
+   pr_warn("%s: query unknown OID 0x%08X\n", __func__, OID);
}
if (retval < 0)
length = 0;
@@ -546,8 +545,8 @@ static int gen_ndis_set_resp(struct rndis_params *params, 
u32 OID,
break;
 
default:
-   pr_warning("%s: set unknown OID 0x%08X, size %d\n",
-__func__, OID, buf_len);
+   pr_warn("%s: set unknown OID 0x%08X, size %d\n",
+   __func__, OID, buf_len);
}
 
return retval;
@@ -854,7 +853,7 @@ int rndis_msg_parser(struct rndis_params *params, u8 *buf)
 * In one case those messages seemed to relate to the host
 * suspending itself.
 */
-   pr_warning("%s: unknown RNDIS message 0x%08X len %d\n",
+   pr_warn("%s: unknown RNDIS message 0x%08X len %d\n",
__func__, MsgType, MsgLength);
print_hex_dump_bytes(__func__, DUMP_PREFIX_OFFSET,
 buf, MsgLength);
diff --git a/drivers/usb/gadget/function/u_serial.c 
b/drivers/usb/gadget/function/u_serial.c
index e0cd1e4c8892..62ec842874aa 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -622,8 +622,8 @@ static void gs_write_complete(struct usb_ep *ep, struct 
usb_request *req)
switch (req->status) {
default:
/* presumably a transient fault */
-   pr_warning("%s: unexpected %s status %d\n",
-   __func__, ep->name, req->status);
+   pr_warn("%s: unexpected %s status %d\n",
+   __func__, ep->name, req->status);
/* FALL THROUGH */
case 0:
/* normal completion */
diff --git a/drivers/usb/gadget/udc/at91_udc.h 
b/drivers/usb/gadget/udc/at91_udc.h
index 0a433e6b346b..9bbe72764f31 100644
--- a/drivers/usb/gadget/udc/at91_udc.h
+++ b/drivers/usb/gadget/udc/at91_udc.h
@@ -175,7 +175,7 @@ struct at91_request {
 #endif
 
 #define ERR(stuff...)  pr_err("udc: " stuff)
-#define WARNING(stuff...)  pr_warning("udc: " stuff)
+#define WARNING(stuff...)  pr_warn("udc: " stuff)
 #define INFO(stuff...) pr_info("udc: " stuff)
 #define DBG(stuff...)  pr_debug("udc: " stuff)
 
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 45bc997d0711..1ef7a9a9d7f5 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1464,8 +1464,8 @@ static void usba_control_irq(struct usba_udc *udc, struct 
usba_ep *ep)
pkt_len = USBA_BFEXT(BYTE_COUNT, usba_ep_readl(ep, STA));
DBG(DBG_HW, "Packet length: %u\n", pkt_len);
if (pkt_len != sizeof(crq)) {
-   pr_warning("udc: Invalid packet length %u "
-   "(expected %zu)\n", pkt_len, sizeof(crq));
+   pr_warn("udc: Invalid packet length %u (expected 
%zu)\n",
+   pkt_len, sizeof(crq));
set_protocol_stall(udc, ep);
return;
}
diff --git a/drivers/usb/gadget/udc/fsl_usb2_udc.h 
b/drivers/usb/gadget/udc/fsl_usb2_udc.h
index 84715625b2b3..e92b8408b6f6 100644
--- a/drivers/usb/gadget/udc/fsl_usb2_udc.h
+++ b/drivers/usb/gadget/udc/fsl_usb2_udc.h
@@ -554,7 +554,7 @@ static void dump_msg(const char *label, const u8 * buf, 
unsigned int length)
 #endif
 
 #define ERR(stuff...)  pr

Re: [PATCH 05/15] usb: chipidea: imx: Change switch order

2016-09-19 Thread Joe Perches
On Mon, 2016-09-19 at 12:18 +0200, Fabien Lahoudere wrote:
> Each USB controller have different behaviour, so in order to avoid to have
> several "swicth(data->index)" and lock/unlock, we prefer to get the index
> and then test for features if they exist for this index.
[]
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
> b/drivers/usb/chipidea/usbmisc_imx.c
[]
> @@ -199,31 +199,45 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data 
> *data)
>   val |= MX53_USB_PLL_DIV_24_MHZ;
>   writel(val, usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET);
>  
> - if (data->disable_oc) {
> - spin_lock_irqsave(>lock, flags);
> - switch (data->index) {
> + spin_lock_irqsave(>lock, flags);
> +
> + switch (data->index) {
>   case 0:
> - reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
> - val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG;
> + if (data->disable_oc) {
> + reg = usbmisc->base + 
> MX53_USB_OTG_PHY_CTRL_0_OFFSET;
> + val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG;
> + if (reg && val)
> + writel(val, reg);
> + }
>   break;

It'd be nicer to unindent the switches case blocks one level too.

switch (case->index){
case 0:
etc...

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/26] constify local structures

2016-09-11 Thread Joe Perches
On Sun, 2016-09-11 at 15:05 +0200, Julia Lawall wrote:
> Constify local structures.

Thanks Julia.

A few suggestions & questions:

Perhaps the script should go into scripts/coccinelle/
so that future cases could be caught by the robot
and commit message referenced by the patch instances.

Can you please compile the files modified using the
appropriate defconfig/allyesconfig and show the
movement from data to const by using
$ size .new/old
and include that in the changelogs (maybe next time)?

Is it possible for a rule to trace the instances where
an address of a struct or struct member is taken by
locally defined and declared function call where the
callee does not modify any dereferenced object?

ie:

struct foo {
int bar;
char *baz;
};

struct foo qux[] = {
{ 1, "description 1" },
{ 2, "dewcription 2" },
[ n, "etc" ]...,
};

void message(struct foo *msg)
{
printk("%d %s\n", msg->bar, msg->baz);
}

where some code uses

message(qux[index]);

So could a coccinelle script change:

struct foo qux[] = { to const struct foo quz[] = {

and

void message(struct foo *msg) to void message(const struct foo *msg)

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] lan78xx: Remove trailing underscores from macros

2016-09-06 Thread Joe Perches
On Wed, 2016-09-07 at 02:00 +, ronnie.ku...@microchip.com wrote:
> Microchip's internal convention is for register (offset) definitions
> to be capitalized (i.e.: MY_REGISTER). Our convention for bits
> (position) definitions within a register is to carry as a prefix the
> name of the register and suffix it with the bit name and adding a
> trailing underscore (i.e. MY_REGISTER_MY_BIT_). The trailing
> underscore is what easily lets us distinguish a bit from a register
> definition when reading code. We have been using this convention for
> many years and has worked very well for us across all projects (by now
> hundreds).

I think it's kind of an ugly convention, but  no
skin off my nose really.

> > Is there anything other than a one-time cost
> > to apply these?  Is the same code used for
> > other platforms?
> 
> Yes, a single header file with the definition of registers and bits is
> shared (either as a standalone file or with its contents pasted into a
> native environment "carrier" header file) across all drivers (and
> other non driver software projects as well) for the same device. So a
> change like this indeed has a high cost for Microchip and we'd rather
> not do this unless it is an absolutely mandated requirement. 

No worries, if you don't like it, don't apply it.

Send a NAK too so David Miller doesn't apply it either.



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] lan78xx: Remove trailing underscores from macros

2016-09-06 Thread Joe Perches
On Tue, 2016-09-06 at 23:19 +, woojung@microchip.com wrote:
> > Joe Perches (2):
> >   lan78xx: Remove locally defined trailing underscores from defines and uses
> >   microchipphy.h and uses: Remove trailing underscores from defines and
> > uses
> > 
> >  drivers/net/phy/microchip.c  |4 +-
> >  drivers/net/usb/lan78xx.c|  368 +++
> >  drivers/net/usb/lan78xx.h| 1068 +-
> > 
> >  include/linux/microchipphy.h |   72 +--
> >  4 files changed, 756 insertions(+), 756 deletions(-)
> 
> 
> Because there is no specific rule how to name defines, I'm not sure it is 
> worth to change 1000+ lines.
> It may be better to set guideline for new submissions.
> 
> Welcome any comments.

Generally, more conforming to norms is better.
These FOO_ uses are non-conforming.

Is there anything other than a one-time cost
to apply these?  Is the same code used for
other platforms?
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] lan78xx: Remove locally defined trailing underscores from defines and uses

2016-09-06 Thread Joe Perches
Macro defines with trailing underscore are hard to read.

These locally defined ones with trailing underscores are all unique
without the trailing underscore, so remove them from the defines and uses.

Global defines that start with LAN88XX_ that are excluded.

Done with:

$ perl -p -i -e 's/\b(?!LAN88XX_)([A-Z0-9_][A-Za-z0-9_]+)_\b/\U\1\E/g' \
  drivers/net/usb/lan78xx.[ch]

and some editing to realign columns in the .h file.

No change in defconfig object.

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/net/usb/lan78xx.c |  340 +++
 drivers/net/usb/lan78xx.h | 1068 ++---
 2 files changed, 704 insertions(+), 704 deletions(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 432b8a3..b6d6d0f 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -548,7 +548,7 @@ static int lan78xx_phy_wait_not_busy(struct lan78xx_net 
*dev)
if (unlikely(ret < 0))
return -EIO;
 
-   if (!(val & MII_ACC_MII_BUSY_))
+   if (!(val & MII_ACC_MII_BUSY))
return 0;
} while (!time_after(jiffies, start_time + HZ));
 
@@ -559,13 +559,13 @@ static inline u32 mii_access(int id, int index, int read)
 {
u32 ret;
 
-   ret = ((u32)id << MII_ACC_PHY_ADDR_SHIFT_) & MII_ACC_PHY_ADDR_MASK_;
-   ret |= ((u32)index << MII_ACC_MIIRINDA_SHIFT_) & MII_ACC_MIIRINDA_MASK_;
+   ret = ((u32)id << MII_ACC_PHY_ADDR_SHIFT) & MII_ACC_PHY_ADDR_MASK;
+   ret |= ((u32)index << MII_ACC_MIIRINDA_SHIFT) & MII_ACC_MIIRINDA_MASK;
if (read)
-   ret |= MII_ACC_MII_READ_;
+   ret |= MII_ACC_MII_READ;
else
-   ret |= MII_ACC_MII_WRITE_;
-   ret |= MII_ACC_MII_BUSY_;
+   ret |= MII_ACC_MII_WRITE;
+   ret |= MII_ACC_MII_BUSY;
 
return ret;
 }
@@ -581,13 +581,13 @@ static int lan78xx_wait_eeprom(struct lan78xx_net *dev)
if (unlikely(ret < 0))
return -EIO;
 
-   if (!(val & E2P_CMD_EPC_BUSY_) ||
-   (val & E2P_CMD_EPC_TIMEOUT_))
+   if (!(val & E2P_CMD_EPC_BUSY) ||
+   (val & E2P_CMD_EPC_TIMEOUT))
break;
usleep_range(40, 100);
} while (!time_after(jiffies, start_time + HZ));
 
-   if (val & (E2P_CMD_EPC_TIMEOUT_ | E2P_CMD_EPC_BUSY_)) {
+   if (val & (E2P_CMD_EPC_TIMEOUT | E2P_CMD_EPC_BUSY)) {
netdev_warn(dev->net, "EEPROM read operation timeout");
return -EIO;
}
@@ -606,7 +606,7 @@ static int lan78xx_eeprom_confirm_not_busy(struct 
lan78xx_net *dev)
if (unlikely(ret < 0))
return -EIO;
 
-   if (!(val & E2P_CMD_EPC_BUSY_))
+   if (!(val & E2P_CMD_EPC_BUSY))
return 0;
 
usleep_range(40, 100);
@@ -629,8 +629,8 @@ static int lan78xx_read_raw_eeprom(struct lan78xx_net *dev, 
u32 offset,
 */
ret = lan78xx_read_reg(dev, HW_CFG, );
saved = val;
-   if (dev->chipid == ID_REV_CHIP_ID_7800_) {
-   val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_);
+   if (dev->chipid == ID_REV_CHIP_ID_7800) {
+   val &= ~(HW_CFG_LED1_EN | HW_CFG_LED0_EN);
ret = lan78xx_write_reg(dev, HW_CFG, val);
}
 
@@ -639,8 +639,8 @@ static int lan78xx_read_raw_eeprom(struct lan78xx_net *dev, 
u32 offset,
return retval;
 
for (i = 0; i < length; i++) {
-   val = E2P_CMD_EPC_BUSY_ | E2P_CMD_EPC_CMD_READ_;
-   val |= (offset & E2P_CMD_EPC_ADDR_MASK_);
+   val = E2P_CMD_EPC_BUSY | E2P_CMD_EPC_CMD_READ;
+   val |= (offset & E2P_CMD_EPC_ADDR_MASK);
ret = lan78xx_write_reg(dev, E2P_CMD, val);
if (unlikely(ret < 0)) {
retval = -EIO;
@@ -663,7 +663,7 @@ static int lan78xx_read_raw_eeprom(struct lan78xx_net *dev, 
u32 offset,
 
retval = 0;
 exit:
-   if (dev->chipid == ID_REV_CHIP_ID_7800_)
+   if (dev->chipid == ID_REV_CHIP_ID_7800)
ret = lan78xx_write_reg(dev, HW_CFG, saved);
 
return retval;
@@ -697,8 +697,8 @@ static int lan78xx_write_raw_eeprom(struct lan78xx_net 
*dev, u32 offset,
 */
ret = lan78xx_read_reg(dev, HW_CFG, );
saved = val;
-   if (dev->chipid == ID_REV_CHIP_ID_7800_) {
-   val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_);
+   if (dev->chipid == ID_REV_CHIP_ID_7800) {
+   val &= ~(HW_CFG_LED1_EN | HW_CFG_LED0_EN);
ret = lan78xx_write_reg(dev, HW_CFG, val);
}
 
@@ -707,7 +707,7 @@ static int lan78xx_write_raw_eeprom(struct lan78xx_net 
*dev, 

[PATCH 0/2] lan78xx: Remove trailing underscores from macros

2016-09-06 Thread Joe Perches
Joe Perches (2):
  lan78xx: Remove locally defined trailing underscores from defines and uses
  microchipphy.h and uses: Remove trailing underscores from defines and uses

 drivers/net/phy/microchip.c  |4 +-
 drivers/net/usb/lan78xx.c|  368 +++
 drivers/net/usb/lan78xx.h| 1068 +-
 include/linux/microchipphy.h |   72 +--
 4 files changed, 756 insertions(+), 756 deletions(-)

-- 
2.10.0.rc2.1.g053435c

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] microchipphy.h and uses: Remove trailing underscores from defines and uses

2016-09-06 Thread Joe Perches
Macro defines with trailing underscore are hard to read.

These uses with trailing underscores are all unique to this .h file,
so remove them from the defines and uses.

Done with:

$ sed -r -i -e 's/\b([A-Z0-9_][A-Za-z0-9_]+)_\b/\U\1\E/g' \
  include/linux/microchipphy.h \
  drivers/net/usb/lan78xx.c \
  drivers/net/phy/microchip.c

and some editing to realign columns in the .h file.

No change in defconfig objects.

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/net/phy/microchip.c  |  4 +--
 drivers/net/usb/lan78xx.c| 28 -
 include/linux/microchipphy.h | 72 ++--
 3 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c
index 15f8206..d8ea811 100644
--- a/drivers/net/phy/microchip.c
+++ b/drivers/net/phy/microchip.c
@@ -39,8 +39,8 @@ static int lan88xx_phy_config_intr(struct phy_device *phydev)
rc = phy_write(phydev, LAN88XX_INT_MASK, 0x7FFF);
rc = phy_read(phydev, LAN88XX_INT_STS);
rc = phy_write(phydev, LAN88XX_INT_MASK,
-  LAN88XX_INT_MASK_MDINTPIN_EN_ |
-  LAN88XX_INT_MASK_LINK_CHANGE_);
+  LAN88XX_INT_MASK_MDINTPIN_EN |
+  LAN88XX_INT_MASK_LINK_CHANGE);
} else {
rc = phy_write(phydev, LAN88XX_INT_MASK, 0);
}
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index b6d6d0f..5e870cc 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1457,27 +1457,27 @@ static void lan78xx_set_mdix_status(struct net_device 
*net, __u8 mdix_ctrl)
phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS,
  LAN88XX_EXT_PAGE_SPACE_1);
buf = phy_read(phydev, LAN88XX_EXT_MODE_CTRL);
-   buf &= ~LAN88XX_EXT_MODE_CTRL_MDIX_MASK_;
+   buf &= ~LAN88XX_EXT_MODE_CTRL_MDIX_MASK;
phy_write(phydev, LAN88XX_EXT_MODE_CTRL,
- buf | LAN88XX_EXT_MODE_CTRL_MDI_);
+ buf | LAN88XX_EXT_MODE_CTRL_MDI);
phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS,
  LAN88XX_EXT_PAGE_SPACE_0);
} else if (mdix_ctrl == ETH_TP_MDI_X) {
phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS,
  LAN88XX_EXT_PAGE_SPACE_1);
buf = phy_read(phydev, LAN88XX_EXT_MODE_CTRL);
-   buf &= ~LAN88XX_EXT_MODE_CTRL_MDIX_MASK_;
+   buf &= ~LAN88XX_EXT_MODE_CTRL_MDIX_MASK;
phy_write(phydev, LAN88XX_EXT_MODE_CTRL,
- buf | LAN88XX_EXT_MODE_CTRL_MDI_X_);
+ buf | LAN88XX_EXT_MODE_CTRL_MDI_X);
phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS,
  LAN88XX_EXT_PAGE_SPACE_0);
} else if (mdix_ctrl == ETH_TP_MDI_AUTO) {
phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS,
  LAN88XX_EXT_PAGE_SPACE_1);
buf = phy_read(phydev, LAN88XX_EXT_MODE_CTRL);
-   buf &= ~LAN88XX_EXT_MODE_CTRL_MDIX_MASK_;
+   buf &= ~LAN88XX_EXT_MODE_CTRL_MDIX_MASK;
phy_write(phydev, LAN88XX_EXT_MODE_CTRL,
- buf | LAN88XX_EXT_MODE_CTRL_AUTO_MDIX_);
+ buf | LAN88XX_EXT_MODE_CTRL_AUTO_MDIX);
phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS,
  LAN88XX_EXT_PAGE_SPACE_0);
}
@@ -1499,14 +1499,14 @@ static int lan78xx_get_settings(struct net_device *net, 
struct ethtool_cmd *cmd)
 
buf = lan78xx_get_mdix_status(net);
 
-   buf &= LAN88XX_EXT_MODE_CTRL_MDIX_MASK_;
-   if (buf == LAN88XX_EXT_MODE_CTRL_AUTO_MDIX_) {
+   buf &= LAN88XX_EXT_MODE_CTRL_MDIX_MASK;
+   if (buf == LAN88XX_EXT_MODE_CTRL_AUTO_MDIX) {
cmd->eth_tp_mdix = ETH_TP_MDI_AUTO;
cmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO;
-   } else if (buf == LAN88XX_EXT_MODE_CTRL_MDI_) {
+   } else if (buf == LAN88XX_EXT_MODE_CTRL_MDI) {
cmd->eth_tp_mdix = ETH_TP_MDI;
cmd->eth_tp_mdix_ctrl = ETH_TP_MDI;
-   } else if (buf == LAN88XX_EXT_MODE_CTRL_MDI_X_) {
+   } else if (buf == LAN88XX_EXT_MODE_CTRL_MDI_X) {
cmd->eth_tp_mdix = ETH_TP_MDI_X;
cmd->eth_tp_mdix_ctrl = ETH_TP_MDI_X;
}
@@ -1815,7 +1815,7 @@ static void lan78xx_link_status_change(struct net_device 
*net)
if (!phydev->autoneg && (phydev->speed == 100)) {
/* disable phy interrupt */
temp = phy_read(phydev, LAN88XX_INT_MASK);
-   temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
+   temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN;
ret = phy_write(phydev, LAN88XX_INT_MASK, 

[PATCH] smsc95xx: Remove trailing underscores from macros and uses

2016-09-06 Thread Joe Perches
Make the #defines a bit more sensible to read.

Done with:

$ sed -r -i -e 's/\b([A-Z0-9_][A-Za-z0-9_]+)_\b/\U\1\E/g' \
  drivers/net/usb/smsc95xx.[ch]

and a little editing of the .h file to realign tabstop define values.

There are 3 [RT]x_COE_ defines that were also uppercased.

No change in defconfig objects.

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/net/usb/smsc95xx.c | 198 +--
 drivers/net/usb/smsc95xx.h | 330 ++---
 2 files changed, 264 insertions(+), 264 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 831aa33..c657fe1 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -178,7 +178,7 @@ static int __must_check __smsc95xx_phy_wait_not_busy(struct 
usbnet *dev,
return ret;
}
 
-   if (!(val & MII_BUSY_))
+   if (!(val & MII_BUSY))
return 0;
} while (!time_after(jiffies, start_time + HZ));
 
@@ -204,7 +204,7 @@ static int __smsc95xx_mdio_read(struct net_device *netdev, 
int phy_id, int idx,
/* set the address, index & direction (read from PHY) */
phy_id &= dev->mii.phy_id_mask;
idx &= dev->mii.reg_num_mask;
-   addr = (phy_id << 11) | (idx << 6) | MII_READ_ | MII_BUSY_;
+   addr = (phy_id << 11) | (idx << 6) | MII_READ | MII_BUSY;
ret = __smsc95xx_write_reg(dev, MII_ADDR, addr, in_pm);
if (ret < 0) {
netdev_warn(dev->net, "Error writing MII_ADDR\n");
@@ -256,7 +256,7 @@ static void __smsc95xx_mdio_write(struct net_device 
*netdev, int phy_id,
/* set the address, index & direction (write to PHY) */
phy_id &= dev->mii.phy_id_mask;
idx &= dev->mii.reg_num_mask;
-   addr = (phy_id << 11) | (idx << 6) | MII_WRITE_ | MII_BUSY_;
+   addr = (phy_id << 11) | (idx << 6) | MII_WRITE | MII_BUSY;
ret = __smsc95xx_write_reg(dev, MII_ADDR, addr, in_pm);
if (ret < 0) {
netdev_warn(dev->net, "Error writing MII_ADDR\n");
@@ -309,12 +309,12 @@ static int __must_check smsc95xx_wait_eeprom(struct 
usbnet *dev)
return ret;
}
 
-   if (!(val & E2P_CMD_BUSY_) || (val & E2P_CMD_TIMEOUT_))
+   if (!(val & E2P_CMD_BUSY) || (val & E2P_CMD_TIMEOUT))
break;
udelay(40);
} while (!time_after(jiffies, start_time + HZ));
 
-   if (val & (E2P_CMD_TIMEOUT_ | E2P_CMD_BUSY_)) {
+   if (val & (E2P_CMD_TIMEOUT | E2P_CMD_BUSY)) {
netdev_warn(dev->net, "EEPROM read operation timeout\n");
return -EIO;
}
@@ -335,7 +335,7 @@ static int __must_check 
smsc95xx_eeprom_confirm_not_busy(struct usbnet *dev)
return ret;
}
 
-   if (!(val & E2P_CMD_BUSY_))
+   if (!(val & E2P_CMD_BUSY))
return 0;
 
udelay(40);
@@ -359,7 +359,7 @@ static int smsc95xx_read_eeprom(struct usbnet *dev, u32 
offset, u32 length,
return ret;
 
for (i = 0; i < length; i++) {
-   val = E2P_CMD_BUSY_ | E2P_CMD_READ_ | (offset & E2P_CMD_ADDR_);
+   val = E2P_CMD_BUSY | E2P_CMD_READ | (offset & E2P_CMD_ADDR);
ret = smsc95xx_write_reg(dev, E2P_CMD, val);
if (ret < 0) {
netdev_warn(dev->net, "Error writing E2P_CMD\n");
@@ -397,7 +397,7 @@ static int smsc95xx_write_eeprom(struct usbnet *dev, u32 
offset, u32 length,
return ret;
 
/* Issue write/erase enable command */
-   val = E2P_CMD_BUSY_ | E2P_CMD_EWEN_;
+   val = E2P_CMD_BUSY | E2P_CMD_EWEN;
ret = smsc95xx_write_reg(dev, E2P_CMD, val);
if (ret < 0) {
netdev_warn(dev->net, "Error writing E2P_DATA\n");
@@ -419,7 +419,7 @@ static int smsc95xx_write_eeprom(struct usbnet *dev, u32 
offset, u32 length,
}
 
/* Send "write" command */
-   val = E2P_CMD_BUSY_ | E2P_CMD_WRITE_ | (offset & E2P_CMD_ADDR_);
+   val = E2P_CMD_BUSY | E2P_CMD_WRITE | (offset & E2P_CMD_ADDR);
ret = smsc95xx_write_reg(dev, E2P_CMD, val);
if (ret < 0) {
netdev_warn(dev->net, "Error writing E2P_CMD\n");
@@ -478,17 +478,17 @@ static void smsc95xx_set_multicast(struct net_device 
*netdev)
 
if (dev->net->flags & IFF_PROMISC) {
netif_dbg(dev, drv, dev->net, "promiscuous mode enabled\n");
-   pdata->mac_cr |= MAC_CR_PRMS_;
-   pdata->mac_cr &

[PATCH 2/2] hso: Convert printk to pr_

2016-09-02 Thread Joe Perches
Use a more common logging style

Miscellanea:

o Add pr_fmt to prefix each output message
o Realign arguments

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/net/usb/hso.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 6c37512..e7b5163 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -50,6 +50,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include 
 #include 
 #include 
@@ -638,7 +640,7 @@ static int get_free_serial_index(void)
}
spin_unlock_irqrestore(_table_lock, flags);
 
-   printk(KERN_ERR "%s: no free serial devices in table\n", __func__);
+   pr_err("%s: no free serial devices in table\n", __func__);
return -1;
 }
 
@@ -1102,7 +1104,7 @@ static void _hso_serial_set_termios(struct tty_struct 
*tty,
struct hso_serial *serial = tty->driver_data;
 
if (!serial) {
-   printk(KERN_ERR "%s: no tty structures", __func__);
+   pr_err("%s: no tty structures", __func__);
return;
}
 
@@ -1347,7 +1349,7 @@ static int hso_serial_write(struct tty_struct *tty, const 
unsigned char *buf,
 
/* sanity check */
if (serial == NULL) {
-   printk(KERN_ERR "%s: serial is NULL\n", __func__);
+   pr_err("%s: serial is NULL\n", __func__);
return -ENODEV;
}
 
@@ -1773,7 +1775,7 @@ static int mux_device_request(struct hso_serial *serial, 
u8 type, u16 port,
 
/* Sanity check */
if (!serial || !ctrl_urb || !ctrl_req) {
-   printk(KERN_ERR "%s: Wrong arguments\n", __func__);
+   pr_err("%s: Wrong arguments\n", __func__);
return -EINVAL;
}
 
@@ -3220,7 +3222,7 @@ static int __init hso_init(void)
int result;
 
/* put it in the log */
-   printk(KERN_INFO "hso: %s\n", version);
+   pr_info("%s\n", version);
 
/* Initialise the serial table semaphore and table */
spin_lock_init(_table_lock);
@@ -3251,16 +3253,15 @@ static int __init hso_init(void)
/* register the tty driver */
result = tty_register_driver(tty_drv);
if (result) {
-   printk(KERN_ERR "%s - tty_register_driver failed(%d)\n",
-   __func__, result);
+   pr_err("%s - tty_register_driver failed(%d)\n",
+  __func__, result);
goto err_free_tty;
}
 
/* register this module as an usb driver */
result = usb_register(_driver);
if (result) {
-   printk(KERN_ERR "Could not register hso driver? error: %d\n",
-   result);
+   pr_err("Could not register hso driver - error: %d\n", result);
goto err_unreg_tty;
}
 
@@ -3275,7 +3276,7 @@ err_free_tty:
 
 static void __exit hso_exit(void)
 {
-   printk(KERN_INFO "hso: unloaded\n");
+   pr_info("unloaded\n");
 
tty_unregister_driver(tty_drv);
put_tty_driver(tty_drv);
-- 
2.10.0.rc2.1.g053435c

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] hso: neatening

2016-09-02 Thread Joe Perches
This seems to be the only code in the kernel that uses
macro defines with a trailing underscore.  Fix that.

Joe Perches (2):
  hso: Use a more common logging style
  hso: Convert printk to pr_

 drivers/net/usb/hso.c | 118 +++---
 1 file changed, 55 insertions(+), 63 deletions(-)

-- 
2.10.0.rc2.1.g053435c

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] hso: Use a more common logging style

2016-09-02 Thread Joe Perches
Macros that end in an underscore are just odd.
Add hso_dbg(level, fmt, ...) and use it everwhere instead.

Several uses had additional unnecessary newlines as the
macro added a newline.  Remove the newline from the macro
and add newlines to each use as appropriate.

Remove now unused D macros.

Signed-off-by: Joe Perches <j...@perches.com>
---
 drivers/net/usb/hso.c | 97 +++
 1 file changed, 44 insertions(+), 53 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index c5544d3..6c37512 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -108,23 +108,12 @@
 /*/
 /* Debugging functions   */
 /*/
-#define D__(lvl_, fmt, arg...) \
-   do {\
-   printk(lvl_ "[%d:%s]: " fmt "\n",   \
-  __LINE__, __func__, ## arg); \
-   } while (0)
-
-#define D_(lvl, args...)   \
-   do {\
-   if (lvl & debug)\
-   D__(KERN_INFO, args);   \
-   } while (0)
-
-#define D1(args...)D_(0x01, ##args)
-#define D2(args...)D_(0x02, ##args)
-#define D3(args...)D_(0x04, ##args)
-#define D4(args...)D_(0x08, ##args)
-#define D5(args...)D_(0x10, ##args)
+#define hso_dbg(lvl, fmt, ...) \
+do {   \
+   if ((lvl) & debug)  \
+   pr_info("[%d:%s] " fmt, \
+   __LINE__, __func__, ##__VA_ARGS__); \
+} while (0)
 
 /*/
 /* Enumerators   */
@@ -709,7 +698,8 @@ static void handle_usb_error(int status, const char 
*function,
}
 
/* log a meaningful explanation of an USB status */
-   D1("%s: received USB status - %s (%d)", function, explanation, status);
+   hso_dbg(0x1, "%s: received USB status - %s (%d)\n",
+   function, explanation, status);
 }
 
 /* Network interface functions */
@@ -808,7 +798,7 @@ static netdev_tx_t hso_net_start_xmit(struct sk_buff *skb,
DUMP1(skb->data, skb->len);
/* Copy it from kernel memory to OUR memory */
memcpy(odev->mux_bulk_tx_buf, skb->data, skb->len);
-   D1("len: %d/%d", skb->len, MUX_BULK_TX_BUF_SIZE);
+   hso_dbg(0x1, "len: %d/%d\n", skb->len, MUX_BULK_TX_BUF_SIZE);
 
/* Fill in the URB for shipping it out. */
usb_fill_bulk_urb(odev->mux_bulk_tx_urb,
@@ -872,7 +862,7 @@ static void packetizeRx(struct hso_net *odev, unsigned char 
*ip_pkt,
unsigned char *tmp_rx_buf;
 
/* log if needed */
-   D1("Rx %d bytes", count);
+   hso_dbg(0x1, "Rx %d bytes\n", count);
DUMP(ip_pkt, min(128, (int)count));
 
while (count) {
@@ -912,7 +902,7 @@ static void packetizeRx(struct hso_net *odev, unsigned char 
*ip_pkt,
frame_len);
if (!odev->skb_rx_buf) {
/* We got no receive buffer. */
-   D1("could not allocate memory");
+   hso_dbg(0x1, "could not allocate 
memory\n");
odev->rx_parse_state = WAIT_SYNC;
continue;
}
@@ -972,11 +962,11 @@ static void packetizeRx(struct hso_net *odev, unsigned 
char *ip_pkt,
break;
 
case WAIT_SYNC:
-   D1(" W_S");
+   hso_dbg(0x1, " W_S\n");
count = 0;
break;
default:
-   D1(" ");
+   hso_dbg(0x1, "\n");
count--;
break;
}
@@ -1020,7 +1010,7 @@ static void read_bulk_callback(struct urb *urb)
 
/* Sanity check */
if (!odev || !test_bit(HSO_NET_RUNNING, >flags)) {
-   D1("BULK IN callback but driver is not active!");
+   hso_dbg(0x1, "BULK IN callback but driver is not active!\n");
return;
}
usb_mark_last_bus

Re: [PATCH v10 11/14] usb: otg: use dev_dbg() instead of VDBG()

2016-06-09 Thread Joe Perches
On Thu, 2016-06-09 at 10:55 +0300, Roger Quadros wrote:
> Now that we have a device reference in struct usb_otg
> let's use dev_vdbg() for debug messages instead of VDBG().
> 
> Signed-off-by: Roger Quadros 
> Acked-by: Peter Chen 
> ---
> v10:
> - in the commit message say dev_vdbg() instead of dev_dbg()

50% - partial credit, see: patch/email subject.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v9 11/14] usb: otg: use dev_dbg() instead of VDBG()

2016-06-08 Thread Joe Perches
On Wed, 2016-06-08 at 12:03 +0300, Roger Quadros wrote:
> Now that we have a device reference in struct usb_otg
> let's use dev_dbg() for debug messages.

dev_vdbg vs dev_dbg

The patch subject and commit message don't match the code changes.

> diff --git a/drivers/usb/common/usb-otg-fsm.c 
> b/drivers/usb/common/usb-otg-fsm.c
[]
> @@ -44,8 +37,9 @@ static int otg_set_protocol(struct otg_fsm *fsm, int 
> protocol)
>   int ret = 0;
>  
>   if (fsm->protocol != protocol) {
> - VDBG("Changing role fsm->protocol= %d; new protocol= %d\n",
> - fsm->protocol, protocol);
> + dev_vdbg(otg->dev,
> +  "Changing role fsm->protocol= %d; new protocol= %d\n",
> +  fsm->protocol, protocol);

etc...

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 10/14] USB: ch341: fix coding style

2016-04-02 Thread Joe Perches
On Sat, 2016-04-02 at 19:07 +0200, Grigori Goronzy wrote:
> No functional change.  The following adjustments were made to be more in
> line with official coding style and to be more consistent.
> 
> Stop mixing tabs and spaces for alignment. Align continuations in
> function prototypes correctly.  Be more consistent with indentation of
> statements broken into multiple lines.  Break some long lines properly.
> Stop putting labels and statements into the same line.  Use braces
> consistently for a single statement.

Most of the whitespace only changes are undesired.

Multi-line statements here are using alignment to
open parenthesis which for some is the preferred
style.
> > diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
[]
> @@ -108,11 +108,11 @@ static int ch341_control_out(struct usb_device *dev, u8 
> request,
>   int r;
>  
>   dev_dbg(>dev, "ch341_control_out(%02x,%02x,%04x,%04x)\n",
> - USB_DIR_OUT|0x40, (int)request, (int)value, (int)index);
> + USB_DIR_OUT|0x40, (int)request, (int)value, (int)index);
>  
>   r = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request,
> - USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
> - value, index, NULL, 0, DEFAULT_TIMEOUT);
> + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
> + value, index, NULL, 0, DEFAULT_TIMEOUT);

The original code is fine.

etc.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 7/7] USB: usbatm: avoid fragile and inefficient snprintf use

2016-03-08 Thread Joe Perches
On Tue, 2016-03-08 at 21:40 +0100, Rasmus Villemoes wrote:
> Passing overlapping source and destination is fragile, and in this
> case we can even simplify the code and avoid the huge stack buffer by
> using the %p extension for printing a small hex dump.
[]
> diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
[]
> @@ -1331,15 +1331,12 @@ MODULE_VERSION(DRIVER_VERSION);
>  static int usbatm_print_packet(struct usbatm_data *instance,
>      const unsigned char *data, int len)
>  {
> - unsigned char buffer[256];
> - int i = 0, j = 0;
> + int i, j;
>  
>   for (i = 0; i < len;) {
> - buffer[0] = '\0';
> - sprintf(buffer, "%.3d :", i);
> - for (j = 0; (j < 16) && (i < len); j++, i++)
> - sprintf(buffer, "%s %2.2x", buffer, data[i]);
> - dev_dbg(>usb_intf->dev, "%s", buffer);
> + j = min(16, len-i);
> + dev_dbg(>usb_intf->dev, "%.3d : %*ph", i, j, data + 
> i);
> + i += j;
>   }
>   return i;
>  }

Maybe use print_dump_hex_debug()

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/5] usb-misc: cleanup sisusbvga

2016-01-06 Thread Joe Perches
On Wed, 2016-01-06 at 16:30 +0100, Peter Senna Tschudin wrote:
> is it ok to fix horizontal issues caused by vertical changes in the
> vertical changes patch?

Yes.

> Is it reasonable to respin if other issues are
> reported for this series?

Your choice.
I think it'd be better to respin in any case.

> > It's also nice to use objdiff and show no object changes.
> Nice tool. I didn't know about it. Should I create a README file for the
> scripts directory?

Maybe.

I think most script and patch submission documentation
is in Documentation/

Maybe this should be added to SubmittingPatches and/or
SubmitChecklist.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Joe Perches
On Tue, 2016-01-05 at 10:12 -0500, Alan Stern wrote:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
> 
> > >> @@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd 
> > >> *ehci, __hc32 token)
> > >>   return '/';
> > >>  }
> > >>
> > >> -static void qh_lines(
> > >> - struct ehci_hcd *ehci,
> > >> - struct ehci_qh *qh,
> > >> - char **nextp,
> > >> - unsigned *sizep
> > >> -)
> > >> +static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
> > >> + char **nextp, unsigned *sizep)
> > >>  {
> > >>   u32 scratch;
> > >>   u32 hw_curr;
> > >>
> > >
> > And about that style? Should be done?
> 
> You mean squeezing the function parameters into two lines?  That's 
> okay.
> 
> However, the style in this file is to indent continuation lines by two
> extra tab stops, not to line things up with an open paren on the first
> line.

It's not consistent.
It's a bit of a mix of 1 and 2 tabs, and some others.


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Joe Perches
On Tue, 2016-01-05 at 11:06 -0500, Alan Stern wrote:
> Trying to come up with hard-and-fast rules for this sort of thing is 
> pretty hopeless.  Even "Maximize readability" doesn't work too well, 
> because different people find different things most readable.

Readability is mostly habituation.

Align to open parenthesis is relatively easy to implement,
but it can get out of hand too with long naming.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Joe Perches
On Tue, 2016-01-05 at 10:12 -0500, Alan Stern wrote:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
> 
> > >> @@ -404,12 +422,8 @@ static inline char token_mark(struct
> ehci_hcd *ehci, __hc32 token)
> > >>   return '/';
> > >>  }
> > >>
> > >> -static void qh_lines(
> > >> - struct ehci_hcd *ehci,
> > >> - struct ehci_qh *qh,
> > >> - char **nextp,
> > >> - unsigned *sizep
> > >> -)
> > >> +static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
> > >> + char **nextp, unsigned *sizep)
> > >>  {
> > >>   u32 scratch;
> > >>   u32 hw_curr;
> > >>
> > >
> > And about that style? Should be done?
> 
> You mean squeezing the function parameters into two lines?  That's 
> okay.
> 
> However, the style in this file is to indent continuation lines by
> two
> extra tab stops, not to line things up with an open paren on the
> first
> line.
> 
> Alan Stern
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/5] usb-misc: cleanup sisusbvga

2016-01-05 Thread Joe Perches
On Tue, 2016-01-05 at 17:54 +0100, Peter Senna Tschudin wrote:
[]
> Patch 1 is the biggest and fix only whitespace, tab and newline issues. I used
> 
> $ git diff -w --word-diff=porcelain drivers/usb/misc/sisusbvga/sisusb.c
> 
> to verify that this patch do not change any visible character. If the size of
> this patch is a problem, please let me know in how many patches to split it.

Thanks.

Maybe for future series, but not one in particular unless
you feel like respinning it:

As porcelain is meant for script consumption,  I think a good
mechanism
for human review is to separate patch 1 into 2 patches.

1: Only horizontal line whitespace changes
   git diff -w shouldn't show any changes and
   git blame -w would not show any change either.
2: Only vertical line changes additions/reformatting

This makes it easy to use git diff -w on patch 1 and
patch 2 can be more easily scanned visually.

It's also nice to use objdiff and show no object changes.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-04 Thread Joe Perches
On Mon, 2016-01-04 at 19:07 -0300, Geyslan G. Bem wrote:
> 2016-01-04 18:52 GMT-03:00 Sergei Shtylyov :
> > > > > > This patch fixes coding style issues reported by checkpatch 
> > > > > > concerning
> > > > > > to unnecessary space after a cast.
> > > > > This is a case where checkpatch is wrong, IMO.  Casts should always be
> > > > > followed by a space.  I will not accept this patch.

Your choice, but most kernel code disagrees with you.

measuring only kernel casts to a pointer, (because there are
too many false positives otherwise) casts without a space
are preferred ~3:1 over casts followed by a space.

(without space)
$ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)\w+" * | 
\
  sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
36612

(with space)
$ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)[ 
\t]\w+" * | \
  sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
13233
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/9] usb/host/fotg210: Remove useless else statement

2015-10-12 Thread Joe Perches
On Mon, 2015-10-12 at 23:22 +0200, Peter Senna Tschudin wrote:
> This patch remove an else statement after a return to make the code
> easier to understand.
[]
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
[]
> @@ -1402,10 +1402,9 @@ static int check_reset_complete(struct fotg210_hcd 
> *fotg210, int index,
>   "Failed to enable port %d on root hub TT\n",
>   index + 1);
>   return port_status;
> - } else {
> - fotg210_dbg(fotg210, "port %d reset complete, port enabled\n",
> - index + 1);
>   }
> + fotg210_dbg(fotg210, "port %d reset complete, port enabled\n",
> + index + 1);
>  
>   return port_status;
>  }

Probably better written as:

/* if reset finished and it's still not enabled -- handoff */
if (!(port_status & PORT_PE))
/* with integrated TT, there's nobody to hand it to! */
fotg210_dbg(fotg210, "failed to enable port %d on root hub 
TT\n",
index + 1);
else
fotg210_dbg(fotg210, "port %d reset complete, port enabled\n",
index + 1);

return port_status;


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: core: driver: Use kmalloc_array

2015-08-23 Thread Joe Perches
On Mon, 2015-08-24 at 00:18 +0530, Muhammad Falak R Wani wrote:
 This patch introduces the use of function kmalloc_array(), instead
 of using kmalloc(), for allocating memory for an array and removes
 the corresponding call to kmalloc().
[]
 diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
[]
 @@ -416,7 +416,7 @@ static int usb_unbind_interface(struct device *dev)
   if (ep-streams == 0)
   continue;
   if (j == 0) {
 - eps = kmalloc(USB_MAXENDPOINTS * sizeof(void *),
 + eps = kmalloc_array(USB_MAXENDPOINTS, sizeof(void *),
 GFP_KERNEL);
   if (!eps) {
   dev_warn(dev, oom, leaking streams\n);

Allocations like this really don't need to use
kmalloc_array as it's unlikely that USB_MAXENDPOINTS
is very large.

If you are going to do this, it'd be nicer to keep
the parenthesis alignment and likely also better to
remove the dev_warn for a memory leak.


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/5] drivers:usb:fsl: Replace macros with enumerated type

2015-05-31 Thread Joe Perches
On Sun, 2015-05-31 at 15:50 +0900, Greg KH wrote:
 On Tue, May 26, 2015 at 05:15:48PM +0530, Nikhil Badola wrote:
  Replace macros with enumerated type to represent usb ip
  controller version
  
  Signed-off-by: Nikhil Badola nikhil.bad...@freescale.com
  ---
   include/linux/fsl_devices.h | 13 -
   1 file changed, 8 insertions(+), 5 deletions(-)
  
  diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
[]
  +enum fsl_usb2_controller_ver {
  +   FSL_USB_VER_OLD = 0,
  +   FSL_USB_VER_1_6,
  +   FSL_USB_VER_2_2,
  +   FSL_USB_VER_2_4,
  +   FSL_USB_VER_2_5,
  +};
 
 Don't you want to change that function that uses these to return the
 enumerated type and not an integer?
 
 Also, I don't think the C standard forces the non-numberd values to be
 sequential,

Then you haven't read the standard in awhile and you likely forgot.

6.7.2.2
If the first enumerator has no =, the value of its enumeration constant
is 0. Each subsequent enumerator with no = defines its enumeration
constant as the value of the constant expression obtained by adding 1 to
the value of the previous enumeration constant.



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: storage: scsiglue: Remove SPRINTF macro use

2015-04-18 Thread Joe Perches
Single transform macros with hidden arguments are not
particularly useful.  Just use seq_printf directly instead.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/usb/storage/scsiglue.c | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 0e400f3..a8cbbff 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -456,17 +456,13 @@ static int write_info(struct Scsi_Host *host, char 
*buffer, int length)
return length;
 }
 
-/* we use this macro to help us write into the buffer */
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ## args)
-
 static int show_info (struct seq_file *m, struct Scsi_Host *host)
 {
struct us_data *us = host_to_us(host);
const char *string;
 
/* print the controller name */
-   SPRINTF(   Host scsi%d: usb-storage\n, host-host_no);
+   seq_printf(m,Host scsi%d: usb-storage\n, host-host_no);
 
/* print product, vendor, and serial number strings */
if (us-pusb_dev-manufacturer)
@@ -475,26 +471,26 @@ static int show_info (struct seq_file *m, struct 
Scsi_Host *host)
string = us-unusual_dev-vendorName;
else
string = Unknown;
-   SPRINTF(   Vendor: %s\n, string);
+   seq_printf(m,Vendor: %s\n, string);
if (us-pusb_dev-product)
string = us-pusb_dev-product;
else if (us-unusual_dev-productName)
string = us-unusual_dev-productName;
else
string = Unknown;
-   SPRINTF(  Product: %s\n, string);
+   seq_printf(m,   Product: %s\n, string);
if (us-pusb_dev-serial)
string = us-pusb_dev-serial;
else
string = None;
-   SPRINTF(Serial Number: %s\n, string);
+   seq_printf(m, Serial Number: %s\n, string);
 
/* show the protocol and transport */
-   SPRINTF( Protocol: %s\n, us-protocol_name);
-   SPRINTF(Transport: %s\n, us-transport_name);
+   seq_printf(m,  Protocol: %s\n, us-protocol_name);
+   seq_printf(m, Transport: %s\n, us-transport_name);
 
/* show the device flags */
-   SPRINTF(   Quirks:);
+   seq_printf(m,Quirks:);
 
 #define US_FLAG(name, value) \
if (us-fflags  value) seq_printf(m,   #name);


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drivers/usb/core: hcd.c: Removed all space warnings from checkpatch.pl

2015-04-11 Thread Joe Perches
On Sat, 2015-04-11 at 03:04 -0700, Chase Metzger wrote:
 Removed all(except false positives, from calculations) space prohibited 
 warnings generated by
 checkpatch.pl.

False positives?  Please describe them.

The only thing I believe you elided was the
use of a BitTime macro which in my opinion
should be used as a function.

drivers/usb/core/hcd.c: tmp = (67667L * (31L + 10L * BitTime 
(bytecount))) / 1000L;

as it is in the include file:

include/linux/usb/hcd.h:+ (2083UL * (3 + BitTime(bytes/1000 \


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drivers/usb/core: devio.c: Removed various errors and warnings generated by checkpatch.pl

2015-04-11 Thread Joe Perches
On Sat, 2015-04-11 at 00:53 -0700, Chase Metzger wrote:
 Fixed several errors and warnings.
[]
 Lines 1040 and 1591: changed dev_printk(KERN_DEBUG, ...) to dev_dbg(...).

These changes hav the possibly undesired effect of
removing these messages completely when DEBUG is not
#defined or when CONFIG_DYNAMIC_DEBUG is not enabled
and these messages are not specifically enabled.

 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
[]
 @@ -1040,7 +1040,7 @@ static int proc_control(struct usb_dev_state *ps, void 
 __user *arg)
   snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, 
 NULL, 0);
   }
   if (i  0  i != -EPIPE) {
 - dev_printk(KERN_DEBUG, dev-dev, usbfs: USBDEVFS_CONTROL 
 + dev_dbg(dev-dev, usbfs: USBDEVFS_CONTROL 
  failed cmd %s rqt %u rq %u len %u ret %d\n,
  current-comm, ctrl.bRequestType, ctrl.bRequest,
  ctrl.wLength, i);
[]
 @@ -1591,8 +1591,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
 struct usbdevfs_urb *uurb
   }
  
   if (ret) {
 - dev_printk(KERN_DEBUG, ps-dev-dev,
 -usbfs: usb_submit_urb returned %d\n, ret);
 + dev_dbg(ps-dev-dev, usbfs: usb_submit_urb returned %d\n, 
 ret);
   snoop_urb(ps-dev, as-userurb, as-urb-pipe,
   0, ret, COMPLETE, NULL, 0);
   async_removepending(as);


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: gadget: s3c2410_udc: Remove static char buffer, use vsprintf extension %pV

2015-03-26 Thread Joe Perches
Using unnecessary static char buffers isn't good.
Use the %pV extension instead.

Miscellanea:

o the dprintk return value is unused, make it void
o add __printf format and argument verification

Signed-off-by: Joe Perches j...@perches.com
---
This doesn't matter much as it is pretty unusual to enable
printk support and CONFIG_USB_S3C2410_DEBUG for this board.

This is just for completeness.

Compiled with and without printk support, but otherwise untested.

 drivers/usb/gadget/udc/s3c2410_udc.c | 28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c 
b/drivers/usb/gadget/udc/s3c2410_udc.c
index b808951..2979575 100644
--- a/drivers/usb/gadget/udc/s3c2410_udc.c
+++ b/drivers/usb/gadget/udc/s3c2410_udc.c
@@ -92,40 +92,38 @@ static struct s3c2410_udc_mach_info *udc_info;
 
 static uint32_t s3c2410_ticks = 0;
 
-static int dprintk(int level, const char *fmt, ...)
+__printf(2, 3)
+static void dprintk(int level, const char *fmt, ...)
 {
-   static char printk_buf[1024];
static long prevticks;
static int invocation;
+   struct va_format vaf;
va_list args;
-   int len;
 
if (level  USB_S3C2410_DEBUG_LEVEL)
-   return 0;
+   return;
+
+   va_start(args, fmt);
+
+   vaf.fmt = fmt;
+   vaf.va = args;
 
if (s3c2410_ticks != prevticks) {
prevticks = s3c2410_ticks;
invocation = 0;
}
 
-   len = scnprintf(printk_buf,
-   sizeof(printk_buf), %1lu.%02d USB: ,
-   prevticks, invocation++);
+   pr_debug(%1lu.%02d USB: %pV, prevticks, invocation++, vaf);
 
-   va_start(args, fmt);
-   len = vscnprintf(printk_buf+len,
-   sizeof(printk_buf)-len, fmt, args);
va_end(args);
-
-   pr_debug(%s, printk_buf);
-   return len;
 }
 #else
-static int dprintk(int level, const char *fmt, ...)
+__printf(2, 3)
+static void dprintk(int level, const char *fmt, ...)
 {
-   return 0;
 }
 #endif
+
 static int s3c2410_udc_debugfs_seq_show(struct seq_file *m, void *p)
 {
u32 addr_reg, pwr_reg, ep_int_reg, usb_int_reg;


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] goku_udc: Remove uses of seq_foo return values

2015-03-16 Thread Joe Perches
The seq_printf/seq_puts/seq_putc return values, because they
are frequently misused, will eventually be converted to void.

See: commit 1f33c41c03da (seq_file: Rename seq_overflow() to
 seq_has_overflowed() and make public)

Miscellanea:

o Coalesce formats, realign arguments
o Create static functions for statement expression macros
o Use c90 style comments instead of c99

Signed-off-by: Joe Perches j...@perches.com
---
compiled/untested

 drivers/usb/gadget/udc/goku_udc.c | 233 --
 1 file changed, 122 insertions(+), 111 deletions(-)

diff --git a/drivers/usb/gadget/udc/goku_udc.c 
b/drivers/usb/gadget/udc/goku_udc.c
index 5b9176e..9e8d842 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -1024,35 +1024,79 @@ static const char proc_node_name [] = driver/udc;
 static void dump_intmask(struct seq_file *m, const char *label, u32 mask)
 {
/* int_status is the same format ... */
-   seq_printf(m,
-   %s %05X = FOURBITS EIGHTBITS EIGHTBITS \n,
-   label, mask,
-   (mask  INT_PWRDETECT) ?  power : ,
-   (mask  INT_SYSERROR) ?  sys : ,
-   (mask  INT_MSTRDEND) ?  in-dma : ,
-   (mask  INT_MSTWRTMOUT) ?  wrtmo : ,
-
-   (mask  INT_MSTWREND) ?  out-dma : ,
-   (mask  INT_MSTWRSET) ?  wrset : ,
-   (mask  INT_ERR) ?  err : ,
-   (mask  INT_SOF) ?  sof : ,
-
-   (mask  INT_EP3NAK) ?  ep3nak : ,
-   (mask  INT_EP2NAK) ?  ep2nak : ,
-   (mask  INT_EP1NAK) ?  ep1nak : ,
-   (mask  INT_EP3DATASET) ?  ep3 : ,
-
-   (mask  INT_EP2DATASET) ?  ep2 : ,
-   (mask  INT_EP1DATASET) ?  ep1 : ,
-   (mask  INT_STATUSNAK) ?  ep0snak : ,
-   (mask  INT_STATUS) ?  ep0status : ,
-
-   (mask  INT_SETUP) ?  setup : ,
-   (mask  INT_ENDPOINT0) ?  ep0 : ,
-   (mask  INT_USBRESET) ?  reset : ,
-   (mask  INT_SUSPEND) ?  suspend : );
+   seq_printf(m, %s %05X = FOURBITS EIGHTBITS EIGHTBITS \n,
+  label, mask,
+  (mask  INT_PWRDETECT) ?  power : ,
+  (mask  INT_SYSERROR) ?  sys : ,
+  (mask  INT_MSTRDEND) ?  in-dma : ,
+  (mask  INT_MSTWRTMOUT) ?  wrtmo : ,
+
+  (mask  INT_MSTWREND) ?  out-dma : ,
+  (mask  INT_MSTWRSET) ?  wrset : ,
+  (mask  INT_ERR) ?  err : ,
+  (mask  INT_SOF) ?  sof : ,
+
+  (mask  INT_EP3NAK) ?  ep3nak : ,
+  (mask  INT_EP2NAK) ?  ep2nak : ,
+  (mask  INT_EP1NAK) ?  ep1nak : ,
+  (mask  INT_EP3DATASET) ?  ep3 : ,
+
+  (mask  INT_EP2DATASET) ?  ep2 : ,
+  (mask  INT_EP1DATASET) ?  ep1 : ,
+  (mask  INT_STATUSNAK) ?  ep0snak : ,
+  (mask  INT_STATUS) ?  ep0status : ,
+
+  (mask  INT_SETUP) ?  setup : ,
+  (mask  INT_ENDPOINT0) ?  ep0 : ,
+  (mask  INT_USBRESET) ?  reset : ,
+  (mask  INT_SUSPEND) ?  suspend : );
+}
+
+static const char *udc_ep_state(enum ep0state state)
+{
+   switch (state) {
+   case EP0_DISCONNECT:
+   return ep0_disconnect;
+   case EP0_IDLE:
+   return ep0_idle;
+   case EP0_IN:
+   return ep0_in;
+   case EP0_OUT:
+   return ep0_out;
+   case EP0_STATUS:
+   return ep0_status;
+   case EP0_STALL:
+   return ep0_stall;
+   case EP0_SUSPEND:
+   return ep0_suspend;
+   }
+
+   return ep0_?;
 }
 
+static const char *udc_ep_status(u32 status)
+{
+   switch (status  EPxSTATUS_EP_MASK) {
+   case EPxSTATUS_EP_READY:
+   return ready;
+   case EPxSTATUS_EP_DATAIN:
+   return packet;
+   case EPxSTATUS_EP_FULL:
+   return full;
+   case EPxSTATUS_EP_TX_ERR:   /* host will retry */
+   return tx_err;
+   case EPxSTATUS_EP_RX_ERR:
+   return rx_err;
+   case EPxSTATUS_EP_BUSY: /* ep0 only */
+   return busy;
+   case EPxSTATUS_EP_STALL:
+   return stall;
+   case EPxSTATUS_EP_INVALID:  /* these can't happen */
+   return invalid;
+   }
+
+   return ?;
+}
 
 static int udc_proc_read(struct seq_file *m, void *v)
 {
@@ -1068,29 +1112,18 @@ static int udc_proc_read(struct seq_file *m, void *v)
tmp = readl(regs-power_detect);
is_usb_connected = tmp  PW_DETECT;
seq_printf(m,
-   %s - %s\n
-   %s version: %s %s\n
-   Gadget driver: %s\n
-   Host %s, %s\n
-   \n,
-   pci_name(dev-pdev), driver_desc,
-   driver_name, DRIVER_VERSION, dmastr

[PATCH net-next 00/14] Use eth_foo_addr instead of memset

2015-03-02 Thread Joe Perches
Joe Perches (14):
  etherdevice: Add eth_foo_addr CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS code
  ethernet: Use eth_foo_addr instead of memset
  net: usb: Use eth_foo_addr instead of memset
  wireless: Use eth_foo_addr instead of memset
  netconsole: Use eth_foo_addr instead of memset
  xen: Use eth_foo_addr instead of memset
  8021q: Use eth_foo_addr instead of memset
  appletalk: Use eth_foo_addr instead of memset
  atm: Use eth_foo_addr instead of memset
  bluetooth: Use eth_foo_addr instead of memset
  ethernet: Use eth_foo_addr instead of memset
  mac80211: Use eth_foo_addr instead of memset
  wireless: Use eth_foo_addr instead of memset
  l2tp: Use eth_foo_addr instead of memset

 drivers/net/ethernet/amd/pcnet32.c |  2 +-
 .../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c|  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |  6 ++--
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c  |  2 +-
 drivers/net/ethernet/cisco/enic/enic_main.c|  8 +++---
 drivers/net/ethernet/emulex/benet/be_cmds.c|  2 +-
 drivers/net/ethernet/emulex/benet/be_main.c|  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  |  4 +--
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |  4 +--
 drivers/net/ethernet/mellanox/mlx4/en_selftest.c   |  2 +-
 drivers/net/ethernet/micrel/ksz884x.c  |  2 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c |  2 +-
 drivers/net/ethernet/qlogic/qlge/qlge_main.c   |  2 +-
 drivers/net/ethernet/smsc/smsc911x.c   |  2 +-
 drivers/net/ethernet/ti/netcp_core.c   |  2 +-
 drivers/net/ethernet/toshiba/ps3_gelic_wireless.c  |  4 +--
 drivers/net/ethernet/xscale/ixp4xx_eth.c   |  2 +-
 drivers/net/netconsole.c   |  5 ++--
 drivers/net/usb/catc.c |  4 +--
 drivers/net/usb/cdc_mbim.c |  2 +-
 drivers/net/usb/lg-vl600.c |  2 +-
 drivers/net/usb/qmi_wwan.c |  2 +-
 drivers/net/wireless/airo.c|  4 +--
 drivers/net/wireless/at76c50x-usb.c|  6 ++--
 drivers/net/wireless/ath/ath10k/mac.c  |  2 +-
 drivers/net/wireless/ath/ath5k/base.c  |  2 +-
 drivers/net/wireless/ath/ath6kl/cfg80211.c |  2 +-
 drivers/net/wireless/ath/ath6kl/main.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c  |  2 +-
 drivers/net/wireless/ath/ath9k/main.c  |  4 +--
 drivers/net/wireless/atmel.c   | 16 +--
 drivers/net/wireless/b43/main.c|  8 +++---
 drivers/net/wireless/b43legacy/main.c  |  8 +++---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 12 
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c |  2 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c  |  2 +-
 drivers/net/wireless/cw1200/sta.c  |  2 +-
 drivers/net/wireless/cw1200/txrx.c |  2 +-
 drivers/net/wireless/hostap/hostap_80211_tx.c  |  4 +--
 drivers/net/wireless/hostap/hostap_ap.c|  8 +++---
 drivers/net/wireless/hostap/hostap_info.c  |  2 +-
 drivers/net/wireless/hostap/hostap_main.c  |  4 +--
 drivers/net/wireless/hostap/hostap_wlan.h  | 33 +++---
 drivers/net/wireless/ipw2x00/ipw2100.c |  8 +++---
 drivers/net/wireless/ipw2x00/ipw2200.c |  6 ++--
 drivers/net/wireless/iwlegacy/common.c |  2 +-
 drivers/net/wireless/iwlwifi/mvm/power.c   |  3 +-
 drivers/net/wireless/libertas/main.c   |  4 +--
 drivers/net/wireless/libertas_tf/main.c|  4 +--
 drivers/net/wireless/mac80211_hwsim.c  |  6 ++--
 drivers/net/wireless/mwifiex/cfg80211.c|  8 +++---
 drivers/net/wireless/mwifiex/init.c|  4 +--
 drivers/net/wireless/mwifiex/sta_event.c   |  2 +-
 drivers/net/wireless/mwifiex/wmm.c |  2 +-
 drivers/net/wireless/mwl8k.c   |  2 +-
 drivers/net/wireless/orinoco/wext.c|  2 +-
 drivers/net/wireless/p54/fwio.c|  2 +-
 drivers/net/wireless/p54/main.c|  8 +++---
 drivers/net/wireless/ray_cs.c  |  2 +-
 drivers/net/wireless/rndis_wlan.c  | 28 +-
 drivers/net/wireless/rtlwifi/core.c|  6 ++--
 drivers/net/wireless/ti/wl1251/main.c  |  4 +--
 drivers/net/wireless/ti/wlcore/cmd.c   |  4 +--
 drivers/net/xen-netback/interface.c|  2 +-
 include/linux/etherdevice.h| 12 +++-
 net/8021q/vlan_dev.c   |  2 +-
 net/appletalk/aarp.c   |  6 ++--
 net/atm/lec.c  |  4 +--
 net/bluetooth/bnep/netdev.c|  2 +-
 net/ethernet/eth.c

[PATCH net-next 03/14] net: usb: Use eth_foo_addr instead of memset

2015-03-02 Thread Joe Perches
Use the built-in function instead of memset.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/net/usb/catc.c | 4 ++--
 drivers/net/usb/cdc_mbim.c | 2 +-
 drivers/net/usb/lg-vl600.c | 2 +-
 drivers/net/usb/qmi_wwan.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 8cfc3bb..4e2b26a 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -641,7 +641,7 @@ static void catc_set_multicast_list(struct net_device 
*netdev)
u8 broadcast[ETH_ALEN];
u8 rx = RxEnable | RxPolarity | RxMultiCast;
 
-   memset(broadcast, 0xff, ETH_ALEN);
+   eth_broadcast_addr(broadcast);
memset(catc-multicast, 0, 64);
 
catc_multicast(broadcast, catc-multicast);
@@ -880,7 +880,7 @@ static int catc_probe(struct usb_interface *intf, const 
struct usb_device_id *id

dev_dbg(dev, Filling the multicast list.\n);
  
-   memset(broadcast, 0xff, ETH_ALEN);
+   eth_broadcast_addr(broadcast);
catc_multicast(broadcast, catc-multicast);
catc_multicast(netdev-dev_addr, catc-multicast);
catc_write_mem(catc, 0xfa80, catc-multicast, 64);
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 96fc8a5..e4b7a47 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -394,7 +394,7 @@ static struct sk_buff *cdc_mbim_process_dgram(struct usbnet 
*dev, u8 *buf, size_
skb_put(skb, ETH_HLEN);
skb_reset_mac_header(skb);
eth_hdr(skb)-h_proto = proto;
-   memset(eth_hdr(skb)-h_source, 0, ETH_ALEN);
+   eth_zero_addr(eth_hdr(skb)-h_source);
memcpy(eth_hdr(skb)-h_dest, dev-net-dev_addr, ETH_ALEN);
 
/* add datagram */
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c
index 8f37efd..5714107 100644
--- a/drivers/net/usb/lg-vl600.c
+++ b/drivers/net/usb/lg-vl600.c
@@ -201,7 +201,7 @@ static int vl600_rx_fixup(struct usbnet *dev, struct 
sk_buff *skb)
buf-data[sizeof(*ethhdr) + 0x12],
ETH_ALEN);
} else {
-   memset(ethhdr-h_source, 0, ETH_ALEN);
+   eth_zero_addr(ethhdr-h_source);
memcpy(ethhdr-h_dest, dev-net-dev_addr, ETH_ALEN);
 
/* Inbound IPv6 packets have an IPv4 ethertype (0x800)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 602dc66..f603f36 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -108,7 +108,7 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct 
sk_buff *skb)
skb_push(skb, ETH_HLEN);
skb_reset_mac_header(skb);
eth_hdr(skb)-h_proto = proto;
-   memset(eth_hdr(skb)-h_source, 0, ETH_ALEN);
+   eth_zero_addr(eth_hdr(skb)-h_source);
 fix_dest:
memcpy(eth_hdr(skb)-h_dest, dev-net-dev_addr, ETH_ALEN);
return 1;
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/27] Convert seq_foo output calls to return void

2015-02-21 Thread Joe Perches
As Al Viro said:

we are getting well-meaning folks who try to check that return value,
again and again, getting it wrong every time.   Typical idiocies:
* return some kind of error out of -show() on overflows.  Pointless
*and* wrong - only hard errors (== fail read(2) with that) should be
reported that way; the caller does detect overflow and retires with bigger
buffer just fine.
* keep checking it after every sodding call of seq_...(), screwing
the cleanups up more often than not.  Pointless, unless you are doing some
seriously expensive calculations to produce something you are going to print.
seq_...() are no-ops in case when overflow has already happened.

seq_has_overflowed() is only for situations when you really want to skip
a serious amount of work generating the data that would end up being
discarded and recalculated again when the caller grabs a bigger buffer and
calls you again.  And more often than not it's an indication of -show()
trying to do the work of iterator - e.g. when you have single_open() with
-show() printing the entire hash table of some sort all in one record.

Most of the time checking return value of seq_...() is better replaced with
not doing that.  And must check return value and Do Something(tm) is too
strong habit for enough people to cause recurring trouble.

Joe Perches (27):
  staging: lustre: Convert return seq_printf(...) uses
  staging: lustre: Convert seq_ hash functions to return void
  staging: lustre: Convert uses of int rc = seq_printf(...)
  staging: lustre: Convert remaining uses of = seq_printf(...)
  x86: mtrr: if: Remove use of seq_printf return value
  power: wakeup: Remove use of seq_printf return value
  ipmi: Remove use of seq_printf return value
  rtc: Remove use of seq_printf return value
  ipc: Remove use of seq_printf return value
  pxa27x_udc: Remove use of seq_printf return value
  microblaze: mb: Remove use of seq_printf return value
  nios2: cpuinfo: Remove use of seq_printf return value
  ARM: plat-pxa: Remove use of seq_printf return value
  openrisc: Remove use of seq_printf return value
  cris: Remove use of seq_printf return value
  mfd: ab8500-debugfs: Remove use of seq_printf return value
  staging: i2o: Remove use of seq_printf return value
  staging: rtl8192x: Remove use of seq_printf return value
  s390: Remove use of seq_printf return value
  i8k: Remove use of seq_printf return value
  watchdog: bcm281xx: Remove use of seq_printf return value
  proc: Remove use of seq_printf return value
  cgroup: Remove use of seq_printf return value
  tracing: Remove use of seq_printf return value
  lru_cache: Remove use of seq_printf return value
  parisc: Remove use of seq_printf return value
  regulator: dbx500: Remove use of seq_puts/seq_printf return value

 arch/arm/plat-pxa/dma.c| 111 ++--
 arch/cris/arch-v10/kernel/setup.c  |  58 +++---
 arch/cris/arch-v32/kernel/setup.c  |  62 +++
 arch/microblaze/kernel/cpu/mb.c| 149 
 arch/nios2/kernel/cpuinfo.c|  77 
 arch/openrisc/kernel/setup.c   |  50 +++---
 arch/s390/pci/pci_debug.c  |   6 +-
 arch/x86/kernel/cpu/mtrr/if.c  |  12 +-
 drivers/base/power/wakeup.c|  16 +-
 drivers/char/i8k.c |  16 +-
 drivers/char/ipmi/ipmi_msghandler.c|  12 +-
 drivers/char/ipmi/ipmi_si_intf.c   |  26 +--
 drivers/char/ipmi/ipmi_ssif.c  |   4 +-
 drivers/mfd/ab8500-debugfs.c   | 196 +
 drivers/parisc/ccio-dma.c  |  54 +++---
 drivers/parisc/sba_iommu.c |  86 +
 drivers/regulator/dbx500-prcmu.c   |  32 +---
 drivers/rtc/rtc-cmos.c |  36 ++--
 drivers/rtc/rtc-ds1305.c   |   6 +-
 drivers/rtc/rtc-mrst.c |  16 +-
 drivers/rtc/rtc-tegra.c|   4 +-
 drivers/s390/cio/blacklist.c   |  12 +-
 drivers/staging/i2o/i2o_proc.c |  18 +-
 .../lustre/include/linux/libcfs/libcfs_hash.h  |   4 +-
 drivers/staging/lustre/lustre/fid/lproc_fid.c  |  23 ++-
 drivers/staging/lustre/lustre/libcfs/hash.c|  13 +-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 117 ++--
 drivers/staging/lustre/lustre/lmv/lproc_lmv.c  |  18 +-
 drivers/staging/lustre/lustre/lov/lproc_lov.c  |  30 ++--
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c  |   6 +-
 .../lustre/lustre/obdclass/linux/linux-module.c|  38 ++--
 .../lustre/lustre/obdclass/lprocfs_status.c| 108 ++--
 drivers/staging/lustre/lustre/obdclass/lu_object.c |  25 +--
 drivers/staging/lustre/lustre/osc/lproc_osc.c  |  67 +++
 .../staging/lustre/lustre

[PATCH 10/27] pxa27x_udc: Remove use of seq_printf return value

2015-02-21 Thread Joe Perches
The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03da (seq_file: Rename seq_overflow() to
 seq_has_overflowed() and make public)

While there, simplify the error handler logic by returning
immediately and remove the unnecessary labels.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/usb/gadget/udc/pxa27x_udc.c | 132 
 1 file changed, 60 insertions(+), 72 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c 
b/drivers/usb/gadget/udc/pxa27x_udc.c
index 6a855fc..486f754 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -93,50 +93,46 @@ static void handle_ep(struct pxa_ep *ep);
 static int state_dbg_show(struct seq_file *s, void *p)
 {
struct pxa_udc *udc = s-private;
-   int pos = 0, ret;
u32 tmp;
 
-   ret = -ENODEV;
if (!udc-driver)
-   goto out;
+   return -ENODEV;
 
/* basic device status */
-   pos += seq_printf(s, DRIVER_DESC \n
-%s version: %s\nGadget driver: %s\n,
-driver_name, DRIVER_VERSION,
-udc-driver ? udc-driver-driver.name : (none));
+   seq_printf(s, DRIVER_DESC \n
+  %s version: %s\n
+  Gadget driver: %s\n,
+  driver_name, DRIVER_VERSION,
+  udc-driver ? udc-driver-driver.name : (none));
 
tmp = udc_readl(udc, UDCCR);
-   pos += seq_printf(s,
-udccr=0x%0x(%s%s%s%s%s%s%s%s%s%s), 
-con=%d,inter=%d,altinter=%d\n, tmp,
-(tmp  UDCCR_OEN) ?  oen:,
-(tmp  UDCCR_AALTHNP) ?  aalthnp:,
-(tmp  UDCCR_AHNP) ?  rem : ,
-(tmp  UDCCR_BHNP) ?  rstir : ,
-(tmp  UDCCR_DWRE) ?  dwre : ,
-(tmp  UDCCR_SMAC) ?  smac : ,
-(tmp  UDCCR_EMCE) ?  emce : ,
-(tmp  UDCCR_UDR) ?  udr : ,
-(tmp  UDCCR_UDA) ?  uda : ,
-(tmp  UDCCR_UDE) ?  ude : ,
-(tmp  UDCCR_ACN)  UDCCR_ACN_S,
-(tmp  UDCCR_AIN)  UDCCR_AIN_S,
-(tmp  UDCCR_AAISN)  UDCCR_AAISN_S);
+   seq_printf(s,
+  udccr=0x%0x(%s%s%s%s%s%s%s%s%s%s), 
con=%d,inter=%d,altinter=%d\n,
+  tmp,
+  (tmp  UDCCR_OEN) ?  oen:,
+  (tmp  UDCCR_AALTHNP) ?  aalthnp:,
+  (tmp  UDCCR_AHNP) ?  rem : ,
+  (tmp  UDCCR_BHNP) ?  rstir : ,
+  (tmp  UDCCR_DWRE) ?  dwre : ,
+  (tmp  UDCCR_SMAC) ?  smac : ,
+  (tmp  UDCCR_EMCE) ?  emce : ,
+  (tmp  UDCCR_UDR) ?  udr : ,
+  (tmp  UDCCR_UDA) ?  uda : ,
+  (tmp  UDCCR_UDE) ?  ude : ,
+  (tmp  UDCCR_ACN)  UDCCR_ACN_S,
+  (tmp  UDCCR_AIN)  UDCCR_AIN_S,
+  (tmp  UDCCR_AAISN)  UDCCR_AAISN_S);
/* registers for device and ep0 */
-   pos += seq_printf(s, udcicr0=0x%08x udcicr1=0x%08x\n,
-   udc_readl(udc, UDCICR0), udc_readl(udc, UDCICR1));
-   pos += seq_printf(s, udcisr0=0x%08x udcisr1=0x%08x\n,
-   udc_readl(udc, UDCISR0), udc_readl(udc, UDCISR1));
-   pos += seq_printf(s, udcfnr=%d\n, udc_readl(udc, UDCFNR));
-   pos += seq_printf(s, irqs: reset=%lu, suspend=%lu, resume=%lu, 
-   reconfig=%lu\n,
-   udc-stats.irqs_reset, udc-stats.irqs_suspend,
-   udc-stats.irqs_resume, udc-stats.irqs_reconfig);
-
-   ret = 0;
-out:
-   return ret;
+   seq_printf(s, udcicr0=0x%08x udcicr1=0x%08x\n,
+  udc_readl(udc, UDCICR0), udc_readl(udc, UDCICR1));
+   seq_printf(s, udcisr0=0x%08x udcisr1=0x%08x\n,
+  udc_readl(udc, UDCISR0), udc_readl(udc, UDCISR1));
+   seq_printf(s, udcfnr=%d\n, udc_readl(udc, UDCFNR));
+   seq_printf(s, irqs: reset=%lu, suspend=%lu, resume=%lu, 
reconfig=%lu\n,
+  udc-stats.irqs_reset, udc-stats.irqs_suspend,
+  udc-stats.irqs_resume, udc-stats.irqs_reconfig);
+
+   return 0;
 }
 
 static int queues_dbg_show(struct seq_file *s, void *p)
@@ -144,75 +140,67 @@ static int queues_dbg_show(struct seq_file *s, void *p)
struct pxa_udc *udc = s-private;
struct pxa_ep *ep;
struct pxa27x_request *req;
-   int pos = 0, i, maxpkt, ret;
+   int i, maxpkt;
 
-   ret = -ENODEV;
if (!udc-driver)
-   goto out;
+   return -ENODEV;
 
/* dump endpoint queues */
for (i = 0; i  NR_PXA_ENDPOINTS; i++) {
ep = udc-pxa_ep[i];
maxpkt = ep-fifo_size

[trivial PATCH] treewide: Remove unnecessary BCMA_CORETABLE_END macro

2015-02-10 Thread Joe Perches
Use the normal {} instead of a macro to terminate an array.

Remove the macro too.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/net/ethernet/broadcom/bgmac.c | 2 +-
 drivers/net/wireless/b43/main.c   | 2 +-
 drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 2 +-
 drivers/spi/spi-bcm53xx.c | 2 +-
 drivers/usb/host/bcma-hcd.c   | 2 +-
 include/linux/mod_devicetable.h   | 2 --
 6 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bgmac.c 
b/drivers/net/ethernet/broadcom/bgmac.c
index 3007d95..ea63cb0 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -21,7 +21,7 @@
 static const struct bcma_device_id bgmac_bcma_tbl[] = {
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, 
BCMA_ANY_CLASS),
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_MAC_GBIT, BCMA_ANY_REV, 
BCMA_ANY_CLASS),
-   BCMA_CORETABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
 
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 2c90886..6acb2b5 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -127,7 +127,7 @@ static const struct bcma_device_id b43_bcma_tbl[] = {
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1E, BCMA_ANY_CLASS),
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x28, BCMA_ANY_CLASS),
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x2A, BCMA_ANY_CLASS),
-   BCMA_CORETABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(bcma, b43_bcma_tbl);
 #endif
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c 
b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index f95b524..4813506 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -99,7 +99,7 @@ static struct bcma_device_id brcms_coreid_table[] = {
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 17, BCMA_ANY_CLASS),
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 23, BCMA_ANY_CLASS),
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 24, BCMA_ANY_CLASS),
-   BCMA_CORETABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(bcma, brcms_coreid_table);
 
diff --git a/drivers/spi/spi-bcm53xx.c b/drivers/spi/spi-bcm53xx.c
index 17b34cb..3fb91c8 100644
--- a/drivers/spi/spi-bcm53xx.c
+++ b/drivers/spi/spi-bcm53xx.c
@@ -216,7 +216,7 @@ static struct spi_board_info bcm53xx_info = {
 
 static const struct bcma_device_id bcm53xxspi_bcma_tbl[] = {
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_QSPI, BCMA_ANY_REV, 
BCMA_ANY_CLASS),
-   BCMA_CORETABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(bcma, bcm53xxspi_bcma_tbl);
 
diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c
index cd6d0af..526cfab 100644
--- a/drivers/usb/host/bcma-hcd.c
+++ b/drivers/usb/host/bcma-hcd.c
@@ -306,7 +306,7 @@ static int bcma_hcd_resume(struct bcma_device *dev)
 
 static const struct bcma_device_id bcma_hcd_table[] = {
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_USB20_HOST, BCMA_ANY_REV, 
BCMA_ANY_CLASS),
-   BCMA_CORETABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(bcma, bcma_hcd_table);
 
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 745def8..6711d57 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -380,8 +380,6 @@ struct bcma_device_id {
 } __attribute__((packed,aligned(2)));
 #define BCMA_CORE(_manuf, _id, _rev, _class)  \
{ .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
-#define BCMA_CORETABLE_END  \
-   { 0, },
 
 #define BCMA_ANY_MANUF 0x
 #define BCMA_ANY_ID0x


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[trivial PATCH] treewide: Remove unnecessary SSB_DEVTABLE_END macro

2015-02-10 Thread Joe Perches
Use the normal {} instead of a macro to terminate an array.

Remove the macro too.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/net/ethernet/broadcom/b44.c   | 2 +-
 drivers/net/wireless/b43/main.c   | 2 +-
 drivers/net/wireless/b43legacy/main.c | 2 +-
 drivers/ssb/driver_gige.c | 2 +-
 drivers/usb/host/ssb-hcd.c| 2 +-
 include/linux/mod_devicetable.h   | 2 --
 6 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/b44.c 
b/drivers/net/ethernet/broadcom/b44.c
index d86d6ba..bd5916a 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -121,7 +121,7 @@ static struct pci_driver b44_pci_driver = {
 
 static const struct ssb_device_id b44_ssb_tbl[] = {
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_ETHERNET, SSB_ANY_REV),
-   SSB_DEVTABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(ssb, b44_ssb_tbl);
 
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 6acb2b5..ccbdb05 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -144,7 +144,7 @@ static const struct ssb_device_id b43_ssb_tbl[] = {
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 13),
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 15),
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 16),
-   SSB_DEVTABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(ssb, b43_ssb_tbl);
 #endif
diff --git a/drivers/net/wireless/b43legacy/main.c 
b/drivers/net/wireless/b43legacy/main.c
index 1aec214..4e58c00 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -86,7 +86,7 @@ MODULE_PARM_DESC(fwpostfix, Postfix for the firmware files 
to load.);
 static const struct ssb_device_id b43legacy_ssb_tbl[] = {
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 2),
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 4),
-   SSB_DEVTABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(ssb, b43legacy_ssb_tbl);
 
diff --git a/drivers/ssb/driver_gige.c b/drivers/ssb/driver_gige.c
index 21f71a1..e973405 100644
--- a/drivers/ssb/driver_gige.c
+++ b/drivers/ssb/driver_gige.c
@@ -24,7 +24,7 @@ MODULE_LICENSE(GPL);
 
 static const struct ssb_device_id ssb_gige_tbl[] = {
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_ETHERNET_GBIT, SSB_ANY_REV),
-   SSB_DEVTABLE_END
+   {},
 };
 /* MODULE_DEVICE_TABLE(ssb, ssb_gige_tbl); */
 
diff --git a/drivers/usb/host/ssb-hcd.c b/drivers/usb/host/ssb-hcd.c
index 0196f76..ffc32f4 100644
--- a/drivers/usb/host/ssb-hcd.c
+++ b/drivers/usb/host/ssb-hcd.c
@@ -251,7 +251,7 @@ static const struct ssb_device_id ssb_hcd_table[] = {
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOSTDEV, SSB_ANY_REV),
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOST, SSB_ANY_REV),
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV),
-   SSB_DEVTABLE_END
+   {},
 };
 MODULE_DEVICE_TABLE(ssb, ssb_hcd_table);
 
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 72f24b6..e530533 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -364,8 +364,6 @@ struct ssb_device_id {
 } __attribute__((packed, aligned(2)));
 #define SSB_DEVICE(_vendor, _coreid, _revision)  \
{ .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
-#define SSB_DEVTABLE_END  \
-   { 0, },
 
 #define SSB_ANY_VENDOR 0x
 #define SSB_ANY_ID 0x


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] usb: gadget: ffs: Fix sparse error

2014-12-24 Thread Joe Perches
On Wed, 2014-12-24 at 14:48 +0530, Rohith Seelaboyina wrote:
 Dynamic memory allocation through kcalloc is more safer
 than declaring variable array size, Fix this error by
 using kcalloc for memory allocation, Check if memory
 allocation is successful and return -ENOMEM on failure.
 
 Signed-off-by: Rohith Seelaboyina rseelaboy...@nvidia.com
 ---
 Changes in v2:
- Use kcalloc to allocate memory instead of using
  kmalloc and memset.

style trivia:

 diff --git a/drivers/usb/gadget/function/f_fs.c 
 b/drivers/usb/gadget/function/f_fs.c
[]
 @@ -397,10 +397,13 @@ static ssize_t __ffs_ep0_read_events(struct ffs_data 
 *ffs, char __user *buf,
* We are holding ffs-ev.waitq.lock and ffs-mutex and we need
* to release them.
*/
 - struct usb_functionfs_event events[n];
   unsigned i = 0;
 + int ret;
 + struct usb_functionfs_event *events = kcalloc(n,
 + sizeof(struct usb_functionfs_event), GFP_KERNEL);
  
 - memset(events, 0, sizeof events);
 + if (unlikely(!events))
 + return -ENOMEM;

unlikely is not commonly used here.

I might be better to separate the declaration and the alloc
{
[...]
struct usb_functionfs_event *events;

events = kcalloc(n, sizeof(*events), GFP_KERNEL);
if (!events)
return -ENOMEM;


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: gadget: ffs: Fix sparse error

2014-12-23 Thread Joe Perches
On Wed, 2014-12-24 at 10:59 +0530, Rohith Seelaboyina wrote:
 Dynamic memory allocation through kmalloc is more safer
 than declaring variable array size, Fix this error by
 using kmalloc for memory allocation, Check if memory
 allocation is successful and return -ENOMEM on failure.
[]
 diff --git a/drivers/usb/gadget/function/f_fs.c 
 b/drivers/usb/gadget/function/f_fs.c
[]
 @@ -397,10 +397,15 @@ static ssize_t __ffs_ep0_read_events(struct ffs_data 
 *ffs, char __user *buf,
* We are holding ffs-ev.waitq.lock and ffs-mutex and we need
* to release them.
*/
 - struct usb_functionfs_event events[n];
   unsigned i = 0;
 + int ret;
 + struct usb_functionfs_event *events = kmalloc(n *
 + sizeof(struct usb_functionfs_event), GFP_KERNEL);
 +
 + if (unlikely(!events))
 + return -ENOMEM;
  
 - memset(events, 0, sizeof events);
 + memset(events, 0, n * sizeof(*events));

kcalloc without memset please.


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/20] fix misspelling of current function in string

2014-12-07 Thread Joe Perches
On Sun, 2014-12-07 at 20:20 +0100, Julia Lawall wrote:
 These patches replace what appears to be a reference to the name of the
 current function but is misspelled in some way by either the name of the
 function itself, or by %s and then __func__ in an argument list.

At least a few of these seem to be function tracing
style uses that might as well be deleted instead.

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next 1/2] seq_puts: Convert to return void and convert uses too.

2014-11-10 Thread Joe Perches
Using the return value of seq_puts is error-prone, so
make it return void instead.

Use seq_has_overflowed where appropriate instead of the
old return value.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/parisc/ccio-dma.c |  7 ++--
 drivers/regulator/dbx500-prcmu.c  | 21 --
 drivers/usb/gadget/udc/goku_udc.c | 81 ---
 drivers/watchdog/bcm_kona_wdt.c   | 43 -
 fs/seq_file.c | 15 
 include/linux/seq_file.h  |  2 +-
 ipc/util.c|  6 ++-
 7 files changed, 89 insertions(+), 86 deletions(-)

diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 8b490d7..c40cc98 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1101,7 +1101,6 @@ static const struct file_operations ccio_proc_info_fops = 
{
 
 static int ccio_proc_bitmap_info(struct seq_file *m, void *p)
 {
-   int len = 0;
struct ioc *ioc = ioc_list;
 
while (ioc != NULL) {
@@ -1110,11 +1109,11 @@ static int ccio_proc_bitmap_info(struct seq_file *m, 
void *p)
 
for (j = 0; j  (ioc-res_size / sizeof(u32)); j++) {
if ((j  7) == 0)
-   len += seq_puts(m, \n   );
-   len += seq_printf(m, %08x, *res_ptr);
+   seq_puts(m, \n   );
+   seq_printf(m, %08x, *res_ptr);
res_ptr++;
}
-   len += seq_puts(m, \n\n);
+   seq_puts(m, \n\n);
ioc = ioc-next;
break; /* XXX - remove me */
}
diff --git a/drivers/regulator/dbx500-prcmu.c b/drivers/regulator/dbx500-prcmu.c
index 2d16b9f..b778ca9 100644
--- a/drivers/regulator/dbx500-prcmu.c
+++ b/drivers/regulator/dbx500-prcmu.c
@@ -129,14 +129,8 @@ static int ux500_regulator_status_print(struct seq_file 
*s, void *p)
int i;
 
/* print dump header */
-   err = seq_puts(s, ux500-regulator status:\n);
-   if (err  0)
-   dev_err(dev, seq_puts overflow\n);
-
-   err = seq_printf(s, %31s : %8s : %8s\n, current,
-   before, after);
-   if (err  0)
-   dev_err(dev, seq_printf overflow\n);
+   seq_puts(s, ux500-regulator status:\n);
+   seq_printf(s, %31s : %8s : %8s\n, current, before, after);
 
for (i = 0; i  rdebug.num_regulators; i++) {
struct dbx500_regulator_info *info;
@@ -144,12 +138,11 @@ static int ux500_regulator_status_print(struct seq_file 
*s, void *p)
info = rdebug.regulator_array[i];
 
/* print status */
-   err = seq_printf(s, %20s : %8s : %8s : %8s\n, info-desc.name,
-   info-is_enabled ? enabled : disabled,
-   rdebug.state_before_suspend[i] ? enabled : disabled,
-   rdebug.state_after_suspend[i] ? enabled : disabled);
-   if (err  0)
-   dev_err(dev, seq_printf overflow\n);
+   seq_printf(s, %20s : %8s : %8s : %8s\n,
+  info-desc.name,
+  info-is_enabled ? enabled : disabled,
+  rdebug.state_before_suspend[i] ? enabled : 
disabled,
+  rdebug.state_after_suspend[i] ? enabled : 
disabled);
}
 
return 0;
diff --git a/drivers/usb/gadget/udc/goku_udc.c 
b/drivers/usb/gadget/udc/goku_udc.c
index 5b9176e..c16b4d9 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -1135,44 +1135,47 @@ static int udc_proc_read(struct seq_file *m, void *v)
continue;
 
tmp = readl(ep-reg_status);
-   if (seq_printf(m,
-   %s %s max %u %s, irqs %lu, 
-   status %02x (%s)  FOURBITS \n,
-   ep-ep.name,
-   ep-is_in ? in : out,
-   ep-ep.maxpacket,
-   ep-dma ? dma : pio,
-   ep-irqs,
-   tmp, ({ char *s;
-   switch (tmp  EPxSTATUS_EP_MASK) {
-   case EPxSTATUS_EP_READY:
-   s = ready; break;
-   case EPxSTATUS_EP_DATAIN:
-   s = packet; break;
-   case EPxSTATUS_EP_FULL:
-   s = full; break;
-   case EPxSTATUS_EP_TX_ERR:   // host will retry
-   s = tx_err; break;
-   case EPxSTATUS_EP_RX_ERR:
-   s = rx_err; break;
-   case EPxSTATUS_EP_BUSY: /* ep0 only */
-   s = busy; break;
-   case EPxSTATUS_EP_STALL:
-   s = stall; break;
-   case

[PATCH -next 0/2] seq: Convert seq_puts and seq_putc to return void

2014-11-10 Thread Joe Perches
These are error prone, so return void adn use seq_has_overflowed instead

Joe Perches (2):
  seq_puts: Convert to return void and convert uses too.
  seq_putc: Convert to return void and convert uses too.

 drivers/char/ipmi/ipmi_msghandler.c|  4 +-
 drivers/parisc/ccio-dma.c  |  7 +-
 drivers/regulator/dbx500-prcmu.c   | 21 ++
 drivers/usb/gadget/udc/goku_udc.c  | 81 +++---
 drivers/watchdog/bcm_kona_wdt.c| 43 +++-
 fs/seq_file.c  | 26 +++
 include/linux/seq_file.h   |  4 +-
 ipc/util.c |  6 +-
 .../netfilter/nf_conntrack_l3proto_ipv4_compat.c   |  4 +-
 net/netfilter/nf_conntrack_expect.c|  4 +-
 10 files changed, 105 insertions(+), 95 deletions(-)

-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] printk: Add and use LOGLEVEL_level defines for KERN_LEVEL equivalents

2014-11-02 Thread Joe Perches
Use #defines instead of magic values.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/usb/storage/debug.c |  2 +-
 include/linux/kern_levels.h | 13 +
 kernel/printk/printk.c  | 28 +---
 lib/dynamic_debug.c |  4 ++--
 4 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c
index e08f647..e43a956 100644
--- a/drivers/usb/storage/debug.c
+++ b/drivers/usb/storage/debug.c
@@ -186,7 +186,7 @@ int usb_stor_dbg(const struct us_data *us, const char *fmt, 
...)
 
va_start(args, fmt);
 
-   r = dev_vprintk_emit(7, us-pusb_dev-dev, fmt, args);
+   r = dev_vprintk_emit(LOGLEVEL_DEBUG, us-pusb_dev-dev, fmt, args);
 
va_end(args);
 
diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h
index 866caaa..3b9e71f 100644
--- a/include/linux/kern_levels.h
+++ b/include/linux/kern_levels.h
@@ -22,4 +22,17 @@
  */
 #define KERN_CONT  
 
+/* integer equivalents of KERN_LEVEL */
+#define LOGLEVEL_SCHED -2  /* Deferred messages from sched code
+* are set to this special level */
+#define LOGLEVEL_DEFAULT   -1  /* default (or last) loglevel */
+#define LOGLEVEL_EMERG 0   /* system is unusable */
+#define LOGLEVEL_ALERT 1   /* action must be taken immediately */
+#define LOGLEVEL_CRIT  2   /* critical conditions */
+#define LOGLEVEL_ERR   3   /* error conditions */
+#define LOGLEVEL_WARNING   4   /* warning conditions */
+#define LOGLEVEL_NOTICE5   /* normal but significant 
condition */
+#define LOGLEVEL_INFO  6   /* informational */
+#define LOGLEVEL_DEBUG 7   /* debug-level messages */
+
 #endif
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index ced2b84..2b8606e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -62,9 +62,6 @@ int console_printk[4] = {
CONSOLE_LOGLEVEL_DEFAULT,   /* default_console_loglevel */
 };
 
-/* Deferred messaged from sched code are marked by this special level */
-#define SCHED_MESSAGE_LOGLEVEL -2
-
 /*
  * Low level drivers may need that to know if they can schedule in
  * their unblank() callback or not. So let's export it.
@@ -1259,7 +1256,7 @@ static int syslog_print_all(char __user *buf, int size, 
bool clear)
 int do_syslog(int type, char __user *buf, int len, bool from_file)
 {
bool clear = false;
-   static int saved_console_loglevel = -1;
+   static int saved_console_loglevel = LOGLEVEL_DEFAULT;
int error;
 
error = check_syslog_permissions(type, from_file);
@@ -1316,15 +1313,15 @@ int do_syslog(int type, char __user *buf, int len, bool 
from_file)
break;
/* Disable logging to console */
case SYSLOG_ACTION_CONSOLE_OFF:
-   if (saved_console_loglevel == -1)
+   if (saved_console_loglevel == LOGLEVEL_DEFAULT)
saved_console_loglevel = console_loglevel;
console_loglevel = minimum_console_loglevel;
break;
/* Enable logging to console */
case SYSLOG_ACTION_CONSOLE_ON:
-   if (saved_console_loglevel != -1) {
+   if (saved_console_loglevel != LOGLEVEL_DEFAULT) {
console_loglevel = saved_console_loglevel;
-   saved_console_loglevel = -1;
+   saved_console_loglevel = LOGLEVEL_DEFAULT;
}
break;
/* Set level of messages printed to console */
@@ -1336,7 +1333,7 @@ int do_syslog(int type, char __user *buf, int len, bool 
from_file)
len = minimum_console_loglevel;
console_loglevel = len;
/* Implicitly re-enable logging to console */
-   saved_console_loglevel = -1;
+   saved_console_loglevel = LOGLEVEL_DEFAULT;
error = 0;
break;
/* Number of chars in the log buffer */
@@ -1629,8 +1626,8 @@ asmlinkage int vprintk_emit(int facility, int level,
/* cpu currently holding logbuf_lock in this function */
static volatile unsigned int logbuf_cpu = UINT_MAX;
 
-   if (level == SCHED_MESSAGE_LOGLEVEL) {
-   level = -1;
+   if (level == LOGLEVEL_SCHED) {
+   level = LOGLEVEL_DEFAULT;
in_sched = true;
}
 
@@ -1695,8 +1692,9 @@ asmlinkage int vprintk_emit(int facility, int level,
const char *end_of_header = printk_skip_level(text);
switch (kern_level) {
case '0' ... '7':
-   if (level == -1)
+   if (level == LOGLEVEL_DEFAULT)
level = kern_level - '0';
+   /* fallthrough

Re: [PATCH v9 1/4] mfd: add support for Diolan DLN-2 devices

2014-10-27 Thread Joe Perches
On Mon, 2014-10-27 at 18:31 +0200, Octavian Purdila wrote:
 This patch implements the USB part of the Diolan USB-I2C/SPI/GPIO
 Master Adapter DLN-2. Details about the device can be found here:

trivia:

 diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
[]
 +static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
 +   const void *obuf, unsigned obuf_len,
 +   void *ibuf, unsigned *ibuf_len)
 +{
 + int ret = 0;
 + int rx_slot;
 + struct dln2_response *rsp;
 + struct dln2_rx_context *rxc;
 + struct device *dev = dln2-interface-dev;
 + const int timeout = DLN2_USB_TIMEOUT * HZ / 1000;

unsigned long timeout?

[]

 + ret = wait_for_completion_interruptible_timeout(rxc-done, timeout);
 + if (ret = 0) {
 + if (!ret)
 + ret = -ETIMEDOUT;
 + goto out_free_rx_slot;
 + }

[]

 +static int dln2_print_serialno(struct dln2_dev *dln2)
 +{
 + int ret;
 + __le32 serial_no;
 + int len = sizeof(serial_no);
 + struct device *dev = dln2-interface-dev;
 +
 + ret = _dln2_transfer(dln2, DLN2_HANDLE_CTRL, CMD_GET_DEVICE_SN, NULL, 0,
 +  serial_no, len);
 + if (ret  0)
 + return ret;
 + if (len  sizeof(serial_no))
 + return -EREMOTEIO;
 +
 + dev_info(dev, Diolan DLN2 serial 0x%x\n, le32_to_cpu(serial_no));

why a hex serial #?


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/11] hwa-hc: Fix probable mask then right shift defect

2014-10-26 Thread Joe Perches
Precedence of  and  is not the same and is not left to right.
shift has higher precedence and should be done after the mask.

Add parentheses around the mask.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/usb/host/hwa-hc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
index d0d8fad..1db0626 100644
--- a/drivers/usb/host/hwa-hc.c
+++ b/drivers/usb/host/hwa-hc.c
@@ -607,7 +607,7 @@ found:
wa-wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr;
if (le16_to_cpu(wa_descr-bcdWAVersion)  0x0100)
dev_warn(dev, Wire Adapter v%d.%d newer than groked v1.0\n,
-le16_to_cpu(wa_descr-bcdWAVersion)  0xff00  8,
+(le16_to_cpu(wa_descr-bcdWAVersion)  0xff00)  8,
 le16_to_cpu(wa_descr-bcdWAVersion)  0x00ff);
result = 0;
 error:
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/11] treewide: mask then shift defects and style updates

2014-10-26 Thread Joe Perches
logical mask has lower precedence than shift but should be
done before the shift so parentheses are generally required.

And when masking with a fixed value after a shift, normal kernel
style has the shift on the left, then the shift on the right so
convert a few non-conforming uses.

Joe Perches (11):
  block: nvme-scsi: Fix probable mask then right shift defects
  radeon: evergreen: Fix probable mask then right shift defects
  aiptek: Fix probable mask then right shift defects
  dvb-net: Fix probable mask then right shift defects
  cx25840/cx18: Use standard ordering of mask and shift
  wm8350-core: Fix probable mask then right shift defect
  iwlwifi: dvm: Fix probable mask then right shift defect
  ssb: driver_chip_comon_pmu: Fix probable mask then right shift defect
  tty: ipwireless: Fix probable mask then right shift defects
  hwa-hc: Fix probable mask then right shift defect
  sound: ad1889: Fix probable mask then right shift defects

 drivers/block/nvme-scsi.c| 12 ++--
 drivers/gpu/drm/radeon/evergreen.c   |  3 ++-
 drivers/input/tablet/aiptek.c|  6 +++---
 drivers/media/dvb-core/dvb_net.c |  4 +++-
 drivers/media/i2c/cx25840/cx25840-core.c | 12 ++--
 drivers/media/pci/cx18/cx18-av-core.c| 16 
 drivers/mfd/wm8350-core.c|  2 +-
 drivers/net/wireless/iwlwifi/dvm/lib.c   |  4 ++--
 drivers/ssb/driver_chipcommon_pmu.c  |  4 ++--
 drivers/tty/ipwireless/hardware.c| 12 ++--
 drivers/usb/host/hwa-hc.c|  2 +-
 sound/pci/ad1889.c   |  8 
 12 files changed, 44 insertions(+), 41 deletions(-)

-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] USB: kobil_sct: Remove unused transfer buffer allocs

2014-10-22 Thread Joe Perches
On Wed, 2014-10-22 at 06:26 -0400, Peter Hurley wrote:
 On 10/22/2014 04:20 AM, Johan Hovold wrote:
  On Thu, Oct 16, 2014 at 01:59:22PM -0400, Peter Hurley wrote:
  Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,
  USB: kobil_sct: fix control requests without data stage, removed
  
  checkpatch.pl complains on your commit-reference style so you know.
 
 Thanks for letting me know.
 
 Joe,
 
 Why is checkpatch complaining about the commit reference above?

 $ ./scripts/checkpatch.pl 
 ../patches/fixes-3.18/0001-USB-kobil_sct-Remove-unused-transfer-buffer-allocs.patch
  
 ERROR: Please use 12 or more chars for the git commit ID like: 'Commit 
 90419cfcb5d9 (USB: kobil_sct: fix control requests without data stage)'
 #6: 
 Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,

It wants parentheses around the commit description.


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: storage: Convert usb_stor_dbg to return void

2014-10-20 Thread Joe Perches
No caller or macro uses the return value so make it void.

Signed-off-by: Joe Perches j...@perches.com
---
This change is associated to a desire to eventually
change printk to return void.

 drivers/usb/storage/debug.c |  7 ++-
 drivers/usb/storage/debug.h | 10 ++
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c
index e08f647..05bc379 100644
--- a/drivers/usb/storage/debug.c
+++ b/drivers/usb/storage/debug.c
@@ -179,17 +179,14 @@ void usb_stor_show_sense(const struct us_data *us,
US_DEBUGPX(\n);
 }
 
-int usb_stor_dbg(const struct us_data *us, const char *fmt, ...)
+void usb_stor_dbg(const struct us_data *us, const char *fmt, ...)
 {
va_list args;
-   int r;
 
va_start(args, fmt);
 
-   r = dev_vprintk_emit(7, us-pusb_dev-dev, fmt, args);
+   dev_vprintk_emit(7, us-pusb_dev-dev, fmt, args);
 
va_end(args);
-
-   return r;
 }
 EXPORT_SYMBOL_GPL(usb_stor_dbg);
diff --git a/drivers/usb/storage/debug.h b/drivers/usb/storage/debug.h
index b1273f0..f525203 100644
--- a/drivers/usb/storage/debug.h
+++ b/drivers/usb/storage/debug.h
@@ -50,15 +50,17 @@
 void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb);
 void usb_stor_show_sense(const struct us_data *us, unsigned char key,
 unsigned char asc, unsigned char ascq);
-__printf(2, 3) int usb_stor_dbg(const struct us_data *us,
-   const char *fmt, ...);
+__printf(2, 3) void usb_stor_dbg(const struct us_data *us,
+const char *fmt, ...);
 
 #define US_DEBUGPX(fmt, ...)   printk(fmt, ##__VA_ARGS__)
 #define US_DEBUG(x)x
 #else
 __printf(2, 3)
-static inline int _usb_stor_dbg(const struct us_data *us,
-   const char *fmt, ...) {return 1;}
+static inline void _usb_stor_dbg(const struct us_data *us,
+const char *fmt, ...)
+{
+}
 #define usb_stor_dbg(us, fmt, ...) \
do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0)
 #define US_DEBUGPX(fmt, ...)   \


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: serial: Fix indentation style issue

2014-10-11 Thread Joe Perches
On Sat, 2014-10-11 at 07:20 -0700, Greg KH wrote:
 On Sat, Oct 11, 2014 at 03:49:43PM +0200, Philip Munksgaard wrote:
  Fix a style issue
[]
  diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
[]
  @@ -1616,7 +1616,7 @@ static const struct usb_device_id option_ids[] = {
  { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
  { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
.driver_info = (kernel_ulong_t)four_g_w14_blacklist
  -   },
  +   },
 
 Why not fix the same 'space' issue on the line before this at the same
 time?

I think there is no space issue on the previous line.
What do you see Greg?



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: atm: fix codestyle issues in

2014-10-11 Thread Joe Perches
On Sun, 2014-10-12 at 00:00 +0700, Lars Melin wrote:
 On 2014-10-11 23:02, Jonas Brunsgaard wrote:
  Signed-off-by: Jonas Brunsgaard jonas.brunsga...@gmail.com
[]
  diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c

[ 15 KB of quoted stuff ]

 Read:
 https://www.kernel.org/doc/Documentation/CodingStyle

Besides needlessly quoting a large quantity of the
previous email, this is an unhelpful comment.

Point out what's wrong with the patch.

AFAICT, nothing in particular.


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: serial: Fix indentation style issue

2014-10-11 Thread Joe Perches
On Sat, 2014-10-11 at 13:19 -0700, Greg KH wrote:
 On Sat, Oct 11, 2014 at 08:36:33AM -0700, Joe Perches wrote:
  On Sat, 2014-10-11 at 07:20 -0700, Greg KH wrote:
   On Sat, Oct 11, 2014 at 03:49:43PM +0200, Philip Munksgaard wrote:
Fix a style issue
  []
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
  []
@@ -1616,7 +1616,7 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
{ USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
  .driver_info = (kernel_ulong_t)four_g_w14_blacklist
-   },
+   },
   
   Why not fix the same 'space' issue on the line before this at the same
   time?
  
  I think there is no space issue on the previous line.
  What do you see Greg?
 
 I see 'space space tab', just like this line that is being changed.

Right, silly evolution previewer can't differentiate space/tab

 /me hands Joe a real editor.

Well, where is it? ;)

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 1/4] mfd: add support for Diolan DLN-2 devices

2014-10-09 Thread Joe Perches
On Thu, 2014-10-09 at 22:22 +0300, Octavian Purdila wrote:
 This patch implements the USB part of the Diolan USB-I2C/SPI/GPIO
 Master Adapter DLN-2. Details about the device can be found here:

trivia:

 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
[]
 +config MFD_DLN2
 + tristate Diolan DLN2 support
 + select MFD_CORE
 + depends on USB
 + help
 +   This adds support for Diolan USB-I2C/SPI/GPIO Master Adapter DLN-2.
 +   Additional drivers must be enabled in order to use the functionality
 +   of the device.

additional drivers like...

 diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
[]
+struct dln2_mod_rx_slots {
+   /* RX slots bitmap */
+   unsigned long bmap;

Probably better as:
DECLARE_BITMAP(bmap, DLN2_MAX_RX_SLOTS);

Then a lot of ptr-bmap uses can be ptr-bmap

 +struct dln2_dev {
 + struct usb_device *usb_dev;
 + struct usb_interface *interface;
 + u8 ep_in;
 + u8 ep_out;
 +
 + struct urb *rx_urb[DLN2_MAX_URBS];
 + void *rx_buf[DLN2_MAX_URBS];
 +
 + struct dln2_mod_rx_slots mod_rx_slots[DLN2_HANDLES];
 +
 + struct list_head event_cb_list;
 + spinlock_t event_cb_lock;
 +
 + bool disconnect;
 + int active_transfers;
 + wait_queue_head_t disconnect_wq;
 + spinlock_t disconnect_lock;
 +};

Maybe reorder the bools and u8s to pack this a bit better?

 +int dln2_register_event_cb(struct platform_device *pdev, u16 id,
 +dln2_event_cb_t rx_cb)
 +{
 + struct dln2_dev *dln2 = dev_get_drvdata(pdev-dev.parent);
 + struct dln2_event_cb_entry *i, *new;

new isn't a very good name

 +static void dln2_run_event_callbacks(struct dln2_dev *dln2, u16 id, u16 echo,
 +  void *data, int len)
 +{
 + struct dln2_event_cb_entry *i;
 +
 + rcu_read_lock();
 +
 + list_for_each_entry_rcu(i, dln2-event_cb_list, list)
 + if (i-id == id)
 + i-callback(i-pdev, echo, data, len);

probably nicer with braces

 +static int dln2_setup_rx_urbs(struct dln2_dev *dln2,
 +   struct usb_host_interface *hostif)
 +{
 + int i;
 + const int rx_max_size = DLN2_RX_BUF_SIZE;
 +
 + for (i = 0; i  DLN2_MAX_URBS; i++) {
 + int ret;
 + struct device *dev = dln2-interface-dev;
 +
 + dln2-rx_buf[i] = kmalloc(rx_max_size, GFP_KERNEL);
 + if (!dln2-rx_buf[i])
 + return -ENOMEM;

memory leaks on failure?


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: core: log higher level message on malformed LANGID descriptor

2014-09-25 Thread Joe Perches
On Thu, 2014-09-25 at 13:56 +, Scot Doyle wrote:
 Commit 0cce2eda19923e5e5ccc8b042dec5af87b3ffad0
 USB: fix LANGID=0 regression

trivia:

 diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
[]
 @@ -770,9 +770,7 @@ static int usb_get_langid(struct usb_device *dev, 
 unsigned char *tbuf)
   dev-string_langid = 0x0409;
   dev-have_langid = 1;
   dev_err(dev-dev,
 - string descriptor 0 malformed (err = %d), 
 - defaulting to 0x%04x\n,
 - err, dev-string_langid);
 + language id specifier not provided by device, 
 defaulting to English);

missing '\n' format termination.



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


project wide: git config entry for [diff] renames=true

2014-09-25 Thread Joe Perches
On Thu, 2014-09-25 at 17:03 +0200, Greg Kroah-Hartman wrote:

 In the future, please generate a git move diff, which makes it easier
 to review, and prove that nothing really changed.  It also helps if the
 file is a bit different from what you diffed against, which in my case,
 was true.

Maybe it'd be possible to add 

[diff]
renames = true

to the .git/config file.

but I don't find a mechanism to add anything to the
.git/config and have it be pulled.



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: project wide: git config entry for [diff] renames=true

2014-09-25 Thread Joe Perches
On Thu, 2014-09-25 at 14:00 -0400, Jeff King wrote:
 On Thu, Sep 25, 2014 at 08:48:31AM -0700, Joe Perches wrote:
 
  On Thu, 2014-09-25 at 17:03 +0200, Greg Kroah-Hartman wrote:
  
   In the future, please generate a git move diff, which makes it easier
   to review, and prove that nothing really changed.  It also helps if the
   file is a bit different from what you diffed against, which in my case,
   was true.
  
  Maybe it'd be possible to add 
  
  [diff]
  renames = true
  
  to the .git/config file.
  
  but I don't find a mechanism to add anything to the
  .git/config and have it be pulled.
 
 There is no such mechanism within git. We've resisted adding one because
 of the danger of something like:
 
   [diff]
 external = rm -rf /
 
 diff.renames is probably safe, but any config-sharing mechanism would
 have to deal with either whitelisting, or providing some mechanism for
 the puller to review changes before blindly following them.

Another mechanism might be to add a repository
top level .gitconfig and add whatever to that.



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/10 linux-next] drivers/usb: remove unnecessary break after goto/return

2014-07-24 Thread Joe Perches
On Thu, 2014-07-24 at 17:46 +0200, Fabian Frederick wrote:
 
  On 24 July 2014 at 13:37 Oliver Neukum oneu...@suse.de wrote:
 
 
  On Thu, 2014-07-24 at 10:18 +0200, Fabian Frederick wrote:
   Small patchset addressing break redundancy on drivers/usb branch
   (suggested by Joe Perches).
 
  Frankly, that is not a good idea. Somebody will remove a goto
  and forget to readd the break
 
 No problem ; checkpatch would give a warning anyway. See Possible switch
 case/default not preceeded by break or fallthrough comment

Generally true, but not everyone uses checkpatch.


--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] staging: usbip: fixed a coding-style warning

2014-06-18 Thread Joe Perches
On Wed, 2014-06-18 at 00:06 -0700, Greg Kroah-Hartman wrote:
 On Wed, Jun 18, 2014 at 09:49:39AM +0300, Alexey Tulia wrote:
  On Tue, Jun 17, 2014 at 03:44:58PM -0700, Greg Kroah-Hartman wrote:
   On Fri, Jun 13, 2014 at 11:35:13AM +0300, Alexey Tulia wrote:
This fixes the following warning:
- WARNING: __constant_cpu_to_le32 should be cpu_to_le32
   
   What produces this warning?
   
  
  This warning was found by checkpatch.pl -f
  

Signed-off-by: Alexey Tulia alexey.tu...@gmail.com
---
 drivers/staging/usbip/vhci_hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/usbip/vhci_hcd.c 
b/drivers/staging/usbip/vhci_hcd.c
index 0007d30..e21c1b4 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -304,7 +304,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, 
u16 typeReq, u16 wValue,
break;
case GetHubStatus:
usbip_dbg_vhci_rh( GetHubStatus\n);
-   *(__le32 *) buf = __constant_cpu_to_le32(0);
+   *(__le32 *) buf = cpu_to_le32(0);
   
   How is this correct?  Why shouldn't __constant_cpu_to_le32() be used
   here?  Heck, why can't we just use 0 given that it doesn't matter the
   endianness of that specific value :)
  
  It may be so, but anyway the __constant_cpu_to_le32 produced a warning
  and it was obvious to clean up this part of code a bit.
  However, the 0 value possibly can change to other value in future and
  this macro acts as a safety net here. 
 
 Dragging Joe in here as he wrote that checkpatch feature.
 
 Joe, how is not using __constant_cpu_to_* a good thing?  If I have a
 constant value, cpu_to_* will be a function call if the bits have to be
 switched around (no-op if not).  I don't see the code path that detects
 a constant value and calls the swap-bits-as-a-constant macro instead,
 unless the __constant_cpu_to* function is called.
 
 Am I just missing it somewhere in the .h include chain?

Probably.

There a __builtin_constant_p check in there via the
include/uapi/linux/swab.h chain.

for instance:

htonl -
___htonl -
__cpu_to_be32
__constant_htonl -
__swab32 -

include/uapi/linux/swab.h:#define __swab32(x)   \
include/uapi/linux/swab.h-  (__builtin_constant_p((__u32)(x)) ? \
include/uapi/linux/swab.h-  ___constant_swab32(x) : \
include/uapi/linux/swab.h-  __fswab32(x))



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -next 24/26] usb: Use dma_zalloc_coherent

2014-06-16 Thread Joe Perches
On Mon, 2014-06-16 at 22:00 +, Paul Zimmerman wrote:
  From: Joe Perches [mailto:j...@perches.com]
  Sent: Sunday, June 15, 2014 1:38 PM
  
  Use the zeroing function instead of dma_alloc_coherent  memset(,0,)
  
  Signed-off-by: Joe Perches j...@perches.com
  ---
   drivers/usb/dwc2/hcd_ddma.c | 20 +++-
   drivers/usb/host/uhci-hcd.c |  7 +++
   2 files changed, 10 insertions(+), 17 deletions(-)
  
  diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c
  index 3376177..ab8d7fc 100644
  --- a/drivers/usb/dwc2/hcd_ddma.c
  +++ b/drivers/usb/dwc2/hcd_ddma.c
  @@ -87,17 +87,12 @@ static u16 dwc2_frame_incr_val(struct dwc2_qh *qh)
   static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh 
  *qh,
  gfp_t flags)
   {
  -   qh-desc_list = dma_alloc_coherent(hsotg-dev,
  -   sizeof(struct dwc2_hcd_dma_desc) *
  -   dwc2_max_desc_num(qh), qh-desc_list_dma,
  -   flags);
  -
  +   qh-desc_list = dma_zalloc_coherent(hsotg-dev,
  +   sizeof(struct dwc2_hcd_dma_desc) * 
  dwc2_max_desc_num(qh),
  +   qh-desc_list_dma, flags);
 
 This will cause checkpatch to complain about a too-long line, surely?

Hi Paul.

It does and I don't care.

 If you fix that, you can add my acked-by for the dwc2 parts.

If you care that much, I can fix it for you, but I
think it's better as a long line.



--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next 24/26] usb: Use dma_zalloc_coherent

2014-06-15 Thread Joe Perches
Use the zeroing function instead of dma_alloc_coherent  memset(,0,)

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/usb/dwc2/hcd_ddma.c | 20 +++-
 drivers/usb/host/uhci-hcd.c |  7 +++
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c
index 3376177..ab8d7fc 100644
--- a/drivers/usb/dwc2/hcd_ddma.c
+++ b/drivers/usb/dwc2/hcd_ddma.c
@@ -87,17 +87,12 @@ static u16 dwc2_frame_incr_val(struct dwc2_qh *qh)
 static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
gfp_t flags)
 {
-   qh-desc_list = dma_alloc_coherent(hsotg-dev,
-   sizeof(struct dwc2_hcd_dma_desc) *
-   dwc2_max_desc_num(qh), qh-desc_list_dma,
-   flags);
-
+   qh-desc_list = dma_zalloc_coherent(hsotg-dev,
+   sizeof(struct dwc2_hcd_dma_desc) * 
dwc2_max_desc_num(qh),
+   qh-desc_list_dma, flags);
if (!qh-desc_list)
return -ENOMEM;
 
-   memset(qh-desc_list, 0,
-  sizeof(struct dwc2_hcd_dma_desc) * dwc2_max_desc_num(qh));
-
qh-n_bytes = kzalloc(sizeof(u32) * dwc2_max_desc_num(qh), flags);
if (!qh-n_bytes) {
dma_free_coherent(hsotg-dev, sizeof(struct dwc2_hcd_dma_desc)
@@ -128,14 +123,13 @@ static int dwc2_frame_list_alloc(struct dwc2_hsotg 
*hsotg, gfp_t mem_flags)
if (hsotg-frame_list)
return 0;
 
-   hsotg-frame_list = dma_alloc_coherent(hsotg-dev,
-  4 * FRLISTEN_64_SIZE,
-  hsotg-frame_list_dma,
-  mem_flags);
+   hsotg-frame_list = dma_zalloc_coherent(hsotg-dev,
+   4 * FRLISTEN_64_SIZE,
+   hsotg-frame_list_dma,
+   mem_flags);
if (!hsotg-frame_list)
return -ENOMEM;
 
-   memset(hsotg-frame_list, 0, 4 * FRLISTEN_64_SIZE);
return 0;
 }
 
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 27f35e8..681fc5e 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -589,15 +589,14 @@ static int uhci_start(struct usb_hcd *hcd)
uhci-dentry = dentry;
 #endif
 
-   uhci-frame = dma_alloc_coherent(uhci_dev(uhci),
-   UHCI_NUMFRAMES * sizeof(*uhci-frame),
-   uhci-frame_dma_handle, 0);
+   uhci-frame = dma_zalloc_coherent(uhci_dev(uhci),
+ UHCI_NUMFRAMES * sizeof(*uhci-frame),
+ uhci-frame_dma_handle, 0);
if (!uhci-frame) {
dev_err(uhci_dev(uhci),
unable to allocate consistent memory for frame 
list\n);
goto err_alloc_frame;
}
-   memset(uhci-frame, 0, UHCI_NUMFRAMES * sizeof(*uhci-frame));
 
uhci-frame_cpu = kcalloc(UHCI_NUMFRAMES, sizeof(*uhci-frame_cpu),
GFP_KERNEL);
-- 
1.8.1.2.459.gbcd45b4.dirty

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next 00/26] treewide: Use dma_zalloc_coherent

2014-06-15 Thread Joe Perches
Use the zeroing function instead of dma_alloc_coherent  memset(,0,)

Joe Perches (26):
  powerpc: Use dma_zalloc_coherent
  sh: Use dma_zalloc_coherent
  ata: Use dma_zalloc_coherent
  block: Use dma_zalloc_coherent
  crypto: Use dma_zalloc_coherent
  dma: Use dma_zalloc_coherent
  gpu: Use dma_zalloc_coherent
  infiniband: Use dma_zalloc_coherent
  mmc: Use dma_zalloc_coherent
  broadcom: Use dma_zalloc_coherent
  hisilicon: Use dma_zalloc_coherent
  intel: Use dma_zalloc_coherent
  ath: Use dma_zalloc_coherent
  rt2x00: Use dma_zalloc_coherent
  bfa: Use dma_zalloc_coherent
  bnx2fc: Use dma_zalloc_coherent
  bnx2i: Use dma_zalloc_coherent
  dpt_i2o: Use dma_zalloc_coherent
  lpfc: Use dma_zalloc_coherent
  megaraid: Use dma_zalloc_coherent
  mvsas: Use dma_zalloc_coherent
  qla2xxx: Use dma_zalloc_coherent
  qla4xxx: Use dma_zalloc_coherent
  usb: Use dma_zalloc_coherent
  fbdev: Use dma_zalloc_coherent
  sound: Use dma_zalloc_coherent

 arch/powerpc/platforms/pasemi/dma_lib.c   |  8 ++--
 arch/powerpc/sysdev/fsl_rmu.c |  9 ++--
 arch/sh/mm/consistent.c   |  4 +-
 drivers/ata/sata_fsl.c|  5 +--
 drivers/block/nvme-core.c |  5 +--
 drivers/crypto/amcc/crypto4xx_core.c  |  8 ++--
 drivers/crypto/ixp4xx_crypto.c|  8 ++--
 drivers/dma/imx-sdma.c|  5 +--
 drivers/dma/mxs-dma.c |  8 ++--
 drivers/gpu/drm/drm_pci.c |  6 +--
 drivers/infiniband/hw/cxgb3/cxio_hal.c|  7 ++--
 drivers/infiniband/hw/mthca/mthca_memfree.c   |  5 +--
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c  | 20 -
 drivers/infiniband/hw/ocrdma/ocrdma_stats.c   |  6 +--
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c   |  8 ++--
 drivers/mmc/host/msm_sdcc.c   |  8 ++--
 drivers/net/ethernet/broadcom/bcm63xx_enet.c  |  6 +--
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c |  5 +--
 drivers/net/ethernet/intel/ixgb/ixgb_main.c   |  6 +--
 drivers/net/wireless/ath/ath10k/pci.c |  8 +---
 drivers/net/wireless/ath/ath10k/wmi.c |  8 +---
 drivers/net/wireless/ath/wcn36xx/dxe.c|  6 +--
 drivers/net/wireless/rt2x00/rt2x00mmio.c  |  8 ++--
 drivers/scsi/bfa/bfad_bsg.c   |  6 +--
 drivers/scsi/bnx2fc/bnx2fc_hwi.c  | 59 ---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c  | 51 ++-
 drivers/scsi/bnx2i/bnx2i_hwi.c| 14 +++
 drivers/scsi/dpt_i2o.c| 19 -
 drivers/scsi/lpfc/lpfc_bsg.c  |  5 +--
 drivers/scsi/lpfc/lpfc_init.c | 22 --
 drivers/scsi/lpfc/lpfc_mbox.c |  6 +--
 drivers/scsi/lpfc/lpfc_sli.c  | 14 +++
 drivers/scsi/megaraid/megaraid_sas_fusion.c   |  9 ++--
 drivers/scsi/mvsas/mv_init.c  | 26 +---
 drivers/scsi/qla2xxx/qla_init.c   | 10 ++---
 drivers/scsi/qla4xxx/ql4_init.c   |  5 +--
 drivers/scsi/qla4xxx/ql4_mbx.c| 21 --
 drivers/scsi/qla4xxx/ql4_nx.c |  5 +--
 drivers/scsi/qla4xxx/ql4_os.c | 12 +++---
 drivers/usb/dwc2/hcd_ddma.c   | 20 -
 drivers/usb/host/uhci-hcd.c   |  7 ++--
 drivers/video/fbdev/da8xx-fb.c|  9 ++--
 sound/aoa/soundbus/i2sbus/core.c  | 12 ++
 sound/sparc/dbri.c|  6 +--
 44 files changed, 197 insertions(+), 308 deletions(-)

-- 
1.8.1.2.459.gbcd45b4.dirty

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   >