RDMA: Manual changes for sysfs_emit and neatening
authorJoe Perches <joe@perches.com>
Thu, 8 Oct 2020 02:36:26 +0000 (19:36 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Sat, 31 Oct 2020 00:03:52 +0000 (21:03 -0300)
commit45808361d4491217de11cdf0661d657081f8f422
treeac2e051297c598c34e9a9ac960aab518e0df589e
parent32053e584e4a342be37a0932ffc1f9b13e914515
RDMA: Manual changes for sysfs_emit and neatening

Make changes to use sysfs_emit in the RDMA code as cocci scripts can not
be written to handle _all_ the possible variants of various sprintf family
uses in sysfs show functions.

While there, make the code more legible and update its style to be more
like the typical kernel styles.

Miscellanea:

o Use intermediate pointers for dereferences
o Add and use string lookup functions
o return early when any intermediate call fails so normal return is
  at the bottom of the function
o mlx4/mcg.c:sysfs_show_group: use scnprintf to format intermediate strings

Link: https://lore.kernel.org/r/f5c9e4c9d8dafca1b7b70bd597ee7f8f219c31c8.1602122880.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/sysfs.c
drivers/infiniband/hw/hfi1/sysfs.c
drivers/infiniband/hw/mlx4/main.c
drivers/infiniband/hw/mlx4/mcg.c
drivers/infiniband/hw/mlx4/sysfs.c
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/qib/qib_sysfs.c
drivers/infiniband/hw/usnic/usnic_ib_sysfs.c
drivers/infiniband/ulp/srp/ib_srp.c