2017-06-09 09:03:30

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 01/11] HID: hid-core: convert to use DRIVER_ATTR_RO and drv_groups

In the quest to get rid of DRIVER_ATTR(), this patch converts the
hid-core code to use DRIVER_ATTR_RO() and also moves to use drv_groups
as creating individual sysfs files is not good (it races with userspace
notifications.)

Cc: Jiri Kosina <[email protected]>
Cc: Benjamin Tissoires <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/hid/hid-core.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 37084b645785..9184033a0de6 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2144,7 +2144,7 @@ struct hid_dynid {
* Adds a new dynamic hid device ID to this driver,
* and causes the driver to probe for all devices again.
*/
-static ssize_t store_new_id(struct device_driver *drv, const char *buf,
+static ssize_t new_id_store(struct device_driver *drv, const char *buf,
size_t count)
{
struct hid_driver *hdrv = to_hid_driver(drv);
@@ -2176,7 +2176,13 @@ static ssize_t store_new_id(struct device_driver *drv, const char *buf,

return ret ? : count;
}
-static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
+static DRIVER_ATTR_WO(new_id);
+
+static struct attribute *hid_drv_attrs[] = {
+ &driver_attr_new_id.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(hid_drv);

static void hid_free_dynids(struct hid_driver *hdrv)
{
@@ -2340,6 +2346,7 @@ static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
static struct bus_type hid_bus_type = {
.name = "hid",
.dev_groups = hid_dev_groups,
+ .drv_groups = hid_drv_groups,
.match = hid_bus_match,
.probe = hid_device_probe,
.remove = hid_device_remove,
@@ -2779,8 +2786,6 @@ EXPORT_SYMBOL_GPL(hid_destroy_device);
int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
const char *mod_name)
{
- int ret;
-
hdrv->driver.name = hdrv->name;
hdrv->driver.bus = &hid_bus_type;
hdrv->driver.owner = owner;
@@ -2789,21 +2794,12 @@ int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
INIT_LIST_HEAD(&hdrv->dyn_list);
spin_lock_init(&hdrv->dyn_lock);

- ret = driver_register(&hdrv->driver);
- if (ret)
- return ret;
-
- ret = driver_create_file(&hdrv->driver, &driver_attr_new_id);
- if (ret)
- driver_unregister(&hdrv->driver);
-
- return ret;
+ return driver_register(&hdrv->driver);
}
EXPORT_SYMBOL_GPL(__hid_register_driver);

void hid_unregister_driver(struct hid_driver *hdrv)
{
- driver_remove_file(&hdrv->driver, &driver_attr_new_id);
driver_unregister(&hdrv->driver);
hid_free_dynids(hdrv);
}
--
2.13.1


2017-06-09 09:03:40

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 02/11] IB: nes: convert to use DRIVER_ATTR_RW

We are trying to get rid of DRIVER_ATTR(), and all of the nes.c driver
attributes can be trivially changed to use DRIVER_ATTR_RW(), making the
code smaller and easier to manage over time.

Cc: Faisal Latif <[email protected]>
Cc: Doug Ledford <[email protected]>
Cc: Sean Hefty <[email protected]>
Cc: Hal Rosenstock <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/infiniband/hw/nes/nes.c | 80 ++++++++++++++++-------------------------
1 file changed, 31 insertions(+), 49 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
index 5b9601014f0c..a30aa6527f7e 100644
--- a/drivers/infiniband/hw/nes/nes.c
+++ b/drivers/infiniband/hw/nes/nes.c
@@ -815,7 +815,7 @@ static struct pci_driver nes_pci_driver = {
.remove = nes_remove,
};

-static ssize_t nes_show_adapter(struct device_driver *ddp, char *buf)
+static ssize_t adapter_show(struct device_driver *ddp, char *buf)
{
unsigned int devfn = 0xffffffff;
unsigned char bus_number = 0xff;
@@ -834,7 +834,7 @@ static ssize_t nes_show_adapter(struct device_driver *ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "%x:%x\n", bus_number, devfn);
}

-static ssize_t nes_store_adapter(struct device_driver *ddp,
+static ssize_t adapter_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -843,7 +843,7 @@ static ssize_t nes_store_adapter(struct device_driver *ddp,
return strnlen(buf, count);
}

-static ssize_t nes_show_ee_cmd(struct device_driver *ddp, char *buf)
+static ssize_t eeprom_cmd_show(struct device_driver *ddp, char *buf)
{
u32 eeprom_cmd = 0xdead;
u32 i = 0;
@@ -859,7 +859,7 @@ static ssize_t nes_show_ee_cmd(struct device_driver *ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "0x%x\n", eeprom_cmd);
}

-static ssize_t nes_store_ee_cmd(struct device_driver *ddp,
+static ssize_t eeprom_cmd_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -880,7 +880,7 @@ static ssize_t nes_store_ee_cmd(struct device_driver *ddp,
return strnlen(buf, count);
}

-static ssize_t nes_show_ee_data(struct device_driver *ddp, char *buf)
+static ssize_t eeprom_data_show(struct device_driver *ddp, char *buf)
{
u32 eeprom_data = 0xdead;
u32 i = 0;
@@ -897,7 +897,7 @@ static ssize_t nes_show_ee_data(struct device_driver *ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "0x%x\n", eeprom_data);
}

-static ssize_t nes_store_ee_data(struct device_driver *ddp,
+static ssize_t eeprom_data_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -918,7 +918,7 @@ static ssize_t nes_store_ee_data(struct device_driver *ddp,
return strnlen(buf, count);
}

-static ssize_t nes_show_flash_cmd(struct device_driver *ddp, char *buf)
+static ssize_t flash_cmd_show(struct device_driver *ddp, char *buf)
{
u32 flash_cmd = 0xdead;
u32 i = 0;
@@ -935,7 +935,7 @@ static ssize_t nes_show_flash_cmd(struct device_driver *ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "0x%x\n", flash_cmd);
}

-static ssize_t nes_store_flash_cmd(struct device_driver *ddp,
+static ssize_t flash_cmd_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -956,7 +956,7 @@ static ssize_t nes_store_flash_cmd(struct device_driver *ddp,
return strnlen(buf, count);
}

-static ssize_t nes_show_flash_data(struct device_driver *ddp, char *buf)
+static ssize_t flash_data_show(struct device_driver *ddp, char *buf)
{
u32 flash_data = 0xdead;
u32 i = 0;
@@ -973,7 +973,7 @@ static ssize_t nes_show_flash_data(struct device_driver *ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "0x%x\n", flash_data);
}

-static ssize_t nes_store_flash_data(struct device_driver *ddp,
+static ssize_t flash_data_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -994,12 +994,12 @@ static ssize_t nes_store_flash_data(struct device_driver *ddp,
return strnlen(buf, count);
}

-static ssize_t nes_show_nonidx_addr(struct device_driver *ddp, char *buf)
+static ssize_t nonidx_addr_show(struct device_driver *ddp, char *buf)
{
return snprintf(buf, PAGE_SIZE, "0x%x\n", sysfs_nonidx_addr);
}

-static ssize_t nes_store_nonidx_addr(struct device_driver *ddp,
+static ssize_t nonidx_addr_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -1010,7 +1010,7 @@ static ssize_t nes_store_nonidx_addr(struct device_driver *ddp,
return strnlen(buf, count);
}

-static ssize_t nes_show_nonidx_data(struct device_driver *ddp, char *buf)
+static ssize_t nonidx_data_show(struct device_driver *ddp, char *buf)
{
u32 nonidx_data = 0xdead;
u32 i = 0;
@@ -1027,7 +1027,7 @@ static ssize_t nes_show_nonidx_data(struct device_driver *ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "0x%x\n", nonidx_data);
}

-static ssize_t nes_store_nonidx_data(struct device_driver *ddp,
+static ssize_t nonidx_data_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -1048,12 +1048,12 @@ static ssize_t nes_store_nonidx_data(struct device_driver *ddp,
return strnlen(buf, count);
}

-static ssize_t nes_show_idx_addr(struct device_driver *ddp, char *buf)
+static ssize_t idx_addr_show(struct device_driver *ddp, char *buf)
{
return snprintf(buf, PAGE_SIZE, "0x%x\n", sysfs_idx_addr);
}

-static ssize_t nes_store_idx_addr(struct device_driver *ddp,
+static ssize_t idx_addr_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -1064,7 +1064,7 @@ static ssize_t nes_store_idx_addr(struct device_driver *ddp,
return strnlen(buf, count);
}

-static ssize_t nes_show_idx_data(struct device_driver *ddp, char *buf)
+static ssize_t idx_data_show(struct device_driver *ddp, char *buf)
{
u32 idx_data = 0xdead;
u32 i = 0;
@@ -1081,7 +1081,7 @@ static ssize_t nes_show_idx_data(struct device_driver *ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "0x%x\n", idx_data);
}

-static ssize_t nes_store_idx_data(struct device_driver *ddp,
+static ssize_t idx_data_store(struct device_driver *ddp,
const char *buf, size_t count)
{
char *p = (char *)buf;
@@ -1102,11 +1102,7 @@ static ssize_t nes_store_idx_data(struct device_driver *ddp,
return strnlen(buf, count);
}

-
-/**
- * nes_show_wqm_quanta
- */
-static ssize_t nes_show_wqm_quanta(struct device_driver *ddp, char *buf)
+static ssize_t wqm_quanta_show(struct device_driver *ddp, char *buf)
{
u32 wqm_quanta_value = 0xdead;
u32 i = 0;
@@ -1123,12 +1119,8 @@ static ssize_t nes_show_wqm_quanta(struct device_driver *ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "0x%X\n", wqm_quanta_value);
}

-
-/**
- * nes_store_wqm_quanta
- */
-static ssize_t nes_store_wqm_quanta(struct device_driver *ddp,
- const char *buf, size_t count)
+static ssize_t wqm_quanta_store(struct device_driver *ddp, const char *buf,
+ size_t count)
{
unsigned long wqm_quanta_value;
u32 wqm_config1;
@@ -1153,26 +1145,16 @@ static ssize_t nes_store_wqm_quanta(struct device_driver *ddp,
return strnlen(buf, count);
}

-static DRIVER_ATTR(adapter, S_IRUSR | S_IWUSR,
- nes_show_adapter, nes_store_adapter);
-static DRIVER_ATTR(eeprom_cmd, S_IRUSR | S_IWUSR,
- nes_show_ee_cmd, nes_store_ee_cmd);
-static DRIVER_ATTR(eeprom_data, S_IRUSR | S_IWUSR,
- nes_show_ee_data, nes_store_ee_data);
-static DRIVER_ATTR(flash_cmd, S_IRUSR | S_IWUSR,
- nes_show_flash_cmd, nes_store_flash_cmd);
-static DRIVER_ATTR(flash_data, S_IRUSR | S_IWUSR,
- nes_show_flash_data, nes_store_flash_data);
-static DRIVER_ATTR(nonidx_addr, S_IRUSR | S_IWUSR,
- nes_show_nonidx_addr, nes_store_nonidx_addr);
-static DRIVER_ATTR(nonidx_data, S_IRUSR | S_IWUSR,
- nes_show_nonidx_data, nes_store_nonidx_data);
-static DRIVER_ATTR(idx_addr, S_IRUSR | S_IWUSR,
- nes_show_idx_addr, nes_store_idx_addr);
-static DRIVER_ATTR(idx_data, S_IRUSR | S_IWUSR,
- nes_show_idx_data, nes_store_idx_data);
-static DRIVER_ATTR(wqm_quanta, S_IRUSR | S_IWUSR,
- nes_show_wqm_quanta, nes_store_wqm_quanta);
+static DRIVER_ATTR_RW(adapter);
+static DRIVER_ATTR_RW(eeprom_cmd);
+static DRIVER_ATTR_RW(eeprom_data);
+static DRIVER_ATTR_RW(flash_cmd);
+static DRIVER_ATTR_RW(flash_data);
+static DRIVER_ATTR_RW(nonidx_addr);
+static DRIVER_ATTR_RW(nonidx_data);
+static DRIVER_ATTR_RW(idx_addr);
+static DRIVER_ATTR_RW(idx_data);
+static DRIVER_ATTR_RW(wqm_quanta);

static int nes_create_driver_sysfs(struct pci_driver *drv)
{
--
2.13.1

2017-06-09 09:03:49

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 05/11] net: caif: convert to use DRIVER_ATTR_RO

We are trying to get rid of DRIVER_ATTR(), and the caif driver's
attributes can be trivially changed to use DRIVER_ATTR_RO().

Cc: Dmitry Tarnyagin <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/net/caif/caif_spi.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c
index 3a529fbe539f..3281a3e0c144 100644
--- a/drivers/net/caif/caif_spi.c
+++ b/drivers/net/caif/caif_spi.c
@@ -289,44 +289,44 @@ static LIST_HEAD(cfspi_list);
static spinlock_t cfspi_list_lock;

/* SPI uplink head alignment. */
-static ssize_t show_up_head_align(struct device_driver *driver, char *buf)
+static ssize_t up_head_align_show(struct device_driver *driver, char *buf)
{
return sprintf(buf, "%d\n", spi_up_head_align);
}

-static DRIVER_ATTR(up_head_align, S_IRUSR, show_up_head_align, NULL);
+static DRIVER_ATTR_RO(up_head_align);

/* SPI uplink tail alignment. */
-static ssize_t show_up_tail_align(struct device_driver *driver, char *buf)
+static ssize_t up_tail_align_show(struct device_driver *driver, char *buf)
{
return sprintf(buf, "%d\n", spi_up_tail_align);
}

-static DRIVER_ATTR(up_tail_align, S_IRUSR, show_up_tail_align, NULL);
+static DRIVER_ATTR_RO(up_tail_align);

/* SPI downlink head alignment. */
-static ssize_t show_down_head_align(struct device_driver *driver, char *buf)
+static ssize_t down_head_align_show(struct device_driver *driver, char *buf)
{
return sprintf(buf, "%d\n", spi_down_head_align);
}

-static DRIVER_ATTR(down_head_align, S_IRUSR, show_down_head_align, NULL);
+static DRIVER_ATTR_RO(down_head_align);

/* SPI downlink tail alignment. */
-static ssize_t show_down_tail_align(struct device_driver *driver, char *buf)
+static ssize_t down_tail_align_show(struct device_driver *driver, char *buf)
{
return sprintf(buf, "%d\n", spi_down_tail_align);
}

-static DRIVER_ATTR(down_tail_align, S_IRUSR, show_down_tail_align, NULL);
+static DRIVER_ATTR_RO(down_tail_align);

/* SPI frame alignment. */
-static ssize_t show_frame_align(struct device_driver *driver, char *buf)
+static ssize_t frame_align_show(struct device_driver *driver, char *buf)
{
return sprintf(buf, "%d\n", spi_frm_align);
}

-static DRIVER_ATTR(frame_align, S_IRUSR, show_frame_align, NULL);
+static DRIVER_ATTR_RO(frame_align);

int cfspi_xmitfrm(struct cfspi *cfspi, u8 *buf, size_t len)
{
--
2.13.1

2017-06-09 09:03:53

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 03/11] PCI: pci-driver: convert to use DRIVER_ATTR_WO

We are trying to get rid of DRIVER_ATTR(), and all of the pci-driver
core driver attributes can be trivially changed to use DRIVER_ATTR_WO().

Cc: Bjorn Helgaas <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/pci/pci-driver.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 192e7b681b96..934a78a2fbef 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -96,7 +96,7 @@ static void pci_free_dynids(struct pci_driver *drv)
*
* Allow PCI IDs to be added to an existing driver via sysfs.
*/
-static ssize_t store_new_id(struct device_driver *driver, const char *buf,
+static ssize_t new_id_store(struct device_driver *driver, const char *buf,
size_t count)
{
struct pci_driver *pdrv = to_pci_driver(driver);
@@ -154,7 +154,7 @@ static ssize_t store_new_id(struct device_driver *driver, const char *buf,
return retval;
return count;
}
-static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
+static DRIVER_ATTR_WO(new_id);

/**
* store_remove_id - remove a PCI device ID from this driver
@@ -164,7 +164,7 @@ static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
*
* Removes a dynamic pci device ID to this driver.
*/
-static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
+static ssize_t remove_id_store(struct device_driver *driver, const char *buf,
size_t count)
{
struct pci_dynid *dynid, *n;
@@ -198,7 +198,7 @@ static ssize_t store_remove_id(struct device_driver *driver, const char *buf,

return retval;
}
-static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id);
+static DRIVER_ATTR_WO(remove_id);

static struct attribute *pci_drv_attrs[] = {
&driver_attr_new_id.attr,
--
2.13.1

2017-06-09 09:04:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 04/11] TTY: hvc: convert to use DRIVER_ATTR_RW

We are trying to get rid of DRIVER_ATTR(), and the hvc driver's
attribute can be trivially changed to use DRIVER_ATTR_RW().

Cc: Jiri Slaby <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/tty/hvc/hvcs.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 99bb875178d7..096ea5f511bd 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -484,13 +484,13 @@ static struct attribute_group hvcs_attr_group = {
.attrs = hvcs_attrs,
};

-static ssize_t hvcs_rescan_show(struct device_driver *ddp, char *buf)
+static ssize_t rescan_show(struct device_driver *ddp, char *buf)
{
/* A 1 means it is updating, a 0 means it is done updating */
return snprintf(buf, PAGE_SIZE, "%d\n", hvcs_rescan_status);
}

-static ssize_t hvcs_rescan_store(struct device_driver *ddp, const char * buf,
+static ssize_t rescan_store(struct device_driver *ddp, const char * buf,
size_t count)
{
if ((simple_strtol(buf, NULL, 0) != 1)
@@ -505,8 +505,7 @@ static ssize_t hvcs_rescan_store(struct device_driver *ddp, const char * buf,
return count;
}

-static DRIVER_ATTR(rescan,
- S_IRUGO | S_IWUSR, hvcs_rescan_show, hvcs_rescan_store);
+static DRIVER_ATTR_RW(rescan);

static void hvcs_kick(void)
{
--
2.13.1

2017-06-09 09:04:21

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 09/11] platform: thinkpad_acpi: convert to use DRIVER_ATTR_RO/RW

We are trying to get rid of DRIVER_ATTR(), and the thinkpad_acpi
driver's attributes can be trivially changed to use DRIVER_ATTR_RO() and
DRIVER_ATTR_RW().

Cc: Henrique de Moraes Holschuh <[email protected]>
Cc: Darren Hart <[email protected]>
Cc: Andy Shevchenko <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/platform/x86/thinkpad_acpi.c | 91 +++++++++++-------------------------
1 file changed, 28 insertions(+), 63 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 7b6cb0c69b02..f6861b551178 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -1438,25 +1438,20 @@ static int tpacpi_rfk_procfs_write(const enum tpacpi_rfk_id id, char *buf)
*/

/* interface_version --------------------------------------------------- */
-static ssize_t tpacpi_driver_interface_version_show(
- struct device_driver *drv,
- char *buf)
+static ssize_t interface_version_show(struct device_driver *drv, char *buf)
{
return snprintf(buf, PAGE_SIZE, "0x%08x\n", TPACPI_SYSFS_VERSION);
}
-
-static DRIVER_ATTR(interface_version, S_IRUGO,
- tpacpi_driver_interface_version_show, NULL);
+static DRIVER_ATTR_RO(interface_version);

/* debug_level --------------------------------------------------------- */
-static ssize_t tpacpi_driver_debug_show(struct device_driver *drv,
- char *buf)
+static ssize_t debug_level_show(struct device_driver *drv, char *buf)
{
return snprintf(buf, PAGE_SIZE, "0x%04x\n", dbg_level);
}

-static ssize_t tpacpi_driver_debug_store(struct device_driver *drv,
- const char *buf, size_t count)
+static ssize_t debug_level_store(struct device_driver *drv, const char *buf,
+ size_t count)
{
unsigned long t;

@@ -1467,34 +1462,28 @@ static ssize_t tpacpi_driver_debug_store(struct device_driver *drv,

return count;
}
-
-static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
- tpacpi_driver_debug_show, tpacpi_driver_debug_store);
+static DRIVER_ATTR_RW(debug_level);

/* version ------------------------------------------------------------- */
-static ssize_t tpacpi_driver_version_show(struct device_driver *drv,
- char *buf)
+static ssize_t version_show(struct device_driver *drv, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%s v%s\n",
TPACPI_DESC, TPACPI_VERSION);
}
-
-static DRIVER_ATTR(version, S_IRUGO,
- tpacpi_driver_version_show, NULL);
+static DRIVER_ATTR_RO(version);

/* --------------------------------------------------------------------- */

#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES

/* wlsw_emulstate ------------------------------------------------------ */
-static ssize_t tpacpi_driver_wlsw_emulstate_show(struct device_driver *drv,
- char *buf)
+static ssize_t wlsw_emulstate_show(struct device_driver *drv, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_wlsw_emulstate);
}

-static ssize_t tpacpi_driver_wlsw_emulstate_store(struct device_driver *drv,
- const char *buf, size_t count)
+static ssize_t wlsw_emulstate_store(struct device_driver *drv, const char *buf,
+ size_t count)
{
unsigned long t;

@@ -1508,22 +1497,16 @@ static ssize_t tpacpi_driver_wlsw_emulstate_store(struct device_driver *drv,

return count;
}
-
-static DRIVER_ATTR(wlsw_emulstate, S_IWUSR | S_IRUGO,
- tpacpi_driver_wlsw_emulstate_show,
- tpacpi_driver_wlsw_emulstate_store);
+static DRIVER_ATTR_RW(wlsw_emulstate);

/* bluetooth_emulstate ------------------------------------------------- */
-static ssize_t tpacpi_driver_bluetooth_emulstate_show(
- struct device_driver *drv,
- char *buf)
+static ssize_t bluetooth_emulstate_show(struct device_driver *drv, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_bluetooth_emulstate);
}

-static ssize_t tpacpi_driver_bluetooth_emulstate_store(
- struct device_driver *drv,
- const char *buf, size_t count)
+static ssize_t bluetooth_emulstate_store(struct device_driver *drv,
+ const char *buf, size_t count)
{
unsigned long t;

@@ -1534,22 +1517,16 @@ static ssize_t tpacpi_driver_bluetooth_emulstate_store(

return count;
}
-
-static DRIVER_ATTR(bluetooth_emulstate, S_IWUSR | S_IRUGO,
- tpacpi_driver_bluetooth_emulstate_show,
- tpacpi_driver_bluetooth_emulstate_store);
+static DRIVER_ATTR_RW(bluetooth_emulstate);

/* wwan_emulstate ------------------------------------------------- */
-static ssize_t tpacpi_driver_wwan_emulstate_show(
- struct device_driver *drv,
- char *buf)
+static ssize_t wwan_emulstate_show(struct device_driver *drv, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_wwan_emulstate);
}

-static ssize_t tpacpi_driver_wwan_emulstate_store(
- struct device_driver *drv,
- const char *buf, size_t count)
+static ssize_t wwan_emulstate_store(struct device_driver *drv, const char *buf,
+ size_t count)
{
unsigned long t;

@@ -1560,22 +1537,16 @@ static ssize_t tpacpi_driver_wwan_emulstate_store(

return count;
}
-
-static DRIVER_ATTR(wwan_emulstate, S_IWUSR | S_IRUGO,
- tpacpi_driver_wwan_emulstate_show,
- tpacpi_driver_wwan_emulstate_store);
+static DRIVER_ATTR_RW(wwan_emulstate);

/* uwb_emulstate ------------------------------------------------- */
-static ssize_t tpacpi_driver_uwb_emulstate_show(
- struct device_driver *drv,
- char *buf)
+static ssize_t uwb_emulstate_show(struct device_driver *drv, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_uwb_emulstate);
}

-static ssize_t tpacpi_driver_uwb_emulstate_store(
- struct device_driver *drv,
- const char *buf, size_t count)
+static ssize_t uwb_emulstate_store(struct device_driver *drv, const char *buf,
+ size_t count)
{
unsigned long t;

@@ -1586,10 +1557,7 @@ static ssize_t tpacpi_driver_uwb_emulstate_store(

return count;
}
-
-static DRIVER_ATTR(uwb_emulstate, S_IWUSR | S_IRUGO,
- tpacpi_driver_uwb_emulstate_show,
- tpacpi_driver_uwb_emulstate_store);
+static DRIVER_ATTR_RW(uwb_emulstate);
#endif

/* --------------------------------------------------------------------- */
@@ -8606,14 +8574,13 @@ static ssize_t fan_fan2_input_show(struct device *dev,
static DEVICE_ATTR(fan2_input, S_IRUGO, fan_fan2_input_show, NULL);

/* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */
-static ssize_t fan_fan_watchdog_show(struct device_driver *drv,
- char *buf)
+static ssize_t fan_watchdog_show(struct device_driver *drv, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%u\n", fan_watchdog_maxinterval);
}

-static ssize_t fan_fan_watchdog_store(struct device_driver *drv,
- const char *buf, size_t count)
+static ssize_t fan_watchdog_store(struct device_driver *drv, const char *buf,
+ size_t count)
{
unsigned long t;

@@ -8630,9 +8597,7 @@ static ssize_t fan_fan_watchdog_store(struct device_driver *drv,

return count;
}
-
-static DRIVER_ATTR(fan_watchdog, S_IWUSR | S_IRUGO,
- fan_fan_watchdog_show, fan_fan_watchdog_store);
+static DRIVER_ATTR_RW(fan_watchdog);

/* --------------------------------------------------------------------- */
static struct attribute *fan_attributes[] = {
--
2.13.1

2017-06-09 09:05:23

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 08/11] pcmcia: ds: convert to use DRIVER_ATTR_RO

We are trying to get rid of DRIVER_ATTR(), and the pcmcia driver's
attribute can be trivially changed to use DRIVER_ATTR_RO().

Cc: Russell King <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/pcmcia/ds.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 69b5e811ea2b..a9258f641cee 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -95,7 +95,7 @@ struct pcmcia_dynid {
* and causes the driver to probe for all devices again.
*/
static ssize_t
-pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count)
+new_id_store(struct device_driver *driver, const char *buf, size_t count)
{
struct pcmcia_dynid *dynid;
struct pcmcia_driver *pdrv = to_pcmcia_drv(driver);
@@ -133,7 +133,7 @@ pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count)
return retval;
return count;
}
-static DRIVER_ATTR(new_id, S_IWUSR, NULL, pcmcia_store_new_id);
+static DRIVER_ATTR_WO(new_id);

static void
pcmcia_free_dynids(struct pcmcia_driver *drv)
--
2.13.1

2017-06-09 09:05:22

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 11/11] USB: usbip: convert to use DRIVER_ATTR_RW

We are trying to get rid of DRIVER_ATTR(), and the usbip driver
attribute can be trivially changed to use DRIVER_ATTR_RW().

Cc: Valentina Manea <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/usb/usbip/stub_main.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
index 44ab43fc4fcc..e74fbb7f4a32 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -134,7 +134,7 @@ int del_match_busid(char *busid)
return ret;
}

-static ssize_t show_match_busid(struct device_driver *drv, char *buf)
+static ssize_t match_busid_show(struct device_driver *drv, char *buf)
{
int i;
char *out = buf;
@@ -149,7 +149,7 @@ static ssize_t show_match_busid(struct device_driver *drv, char *buf)
return out - buf;
}

-static ssize_t store_match_busid(struct device_driver *dev, const char *buf,
+static ssize_t match_busid_store(struct device_driver *dev, const char *buf,
size_t count)
{
int len;
@@ -181,8 +181,7 @@ static ssize_t store_match_busid(struct device_driver *dev, const char *buf,

return -EINVAL;
}
-static DRIVER_ATTR(match_busid, S_IRUSR | S_IWUSR, show_match_busid,
- store_match_busid);
+static DRIVER_ATTR_RW(match_busid);

static ssize_t rebind_store(struct device_driver *dev, const char *buf,
size_t count)
--
2.13.1

2017-06-09 09:04:02

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 07/11] wireless: ipw2x00: convert to use DRIVER_ATTR_RW

We are trying to get rid of DRIVER_ATTR(), and the ipw2x00 driver's
attributes can be trivially changed to use DRIVER_ATTR_RW().

Cc: Stanislav Yakovlev <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/net/wireless/intel/ipw2x00/ipw2100.c | 8 +++-----
drivers/net/wireless/intel/ipw2x00/ipw2200.c | 8 +++-----
2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2100.c b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
index f922859acf40..aaaca4d08e2b 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
@@ -4160,12 +4160,12 @@ static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr,
static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL);

#ifdef CONFIG_IPW2100_DEBUG
-static ssize_t show_debug_level(struct device_driver *d, char *buf)
+static ssize_t debug_level_show(struct device_driver *d, char *buf)
{
return sprintf(buf, "0x%08X\n", ipw2100_debug_level);
}

-static ssize_t store_debug_level(struct device_driver *d,
+static ssize_t debug_level_store(struct device_driver *d,
const char *buf, size_t count)
{
u32 val;
@@ -4179,9 +4179,7 @@ static ssize_t store_debug_level(struct device_driver *d,

return strnlen(buf, count);
}
-
-static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level,
- store_debug_level);
+static DRIVER_ATTR_RW(debug_level);
#endif /* CONFIG_IPW2100_DEBUG */

static ssize_t show_fatal_error(struct device *d,
diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
index bbc579b647b6..5b79e2ec3a16 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -1195,12 +1195,12 @@ static void ipw_led_shutdown(struct ipw_priv *priv)
*
* See the level definitions in ipw for details.
*/
-static ssize_t show_debug_level(struct device_driver *d, char *buf)
+static ssize_t debug_level_show(struct device_driver *d, char *buf)
{
return sprintf(buf, "0x%08X\n", ipw_debug_level);
}

-static ssize_t store_debug_level(struct device_driver *d, const char *buf,
+static ssize_t debug_level_store(struct device_driver *d, const char *buf,
size_t count)
{
char *p = (char *)buf;
@@ -1221,9 +1221,7 @@ static ssize_t store_debug_level(struct device_driver *d, const char *buf,

return strnlen(buf, count);
}
-
-static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
- show_debug_level, store_debug_level);
+static DRIVER_ATTR_RW(debug_level);

static inline u32 ipw_get_event_log_len(struct ipw_priv *priv)
{
--
2.13.1

2017-06-09 09:06:24

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 10/11] s390: drivers: convert to use DRIVER_ATTR_RO/WO

We are trying to get rid of DRIVER_ATTR(), and the s390 drivers'
attributes can be trivially changed to use DRIVER_ATTR_RO() and
DRIVER_ATTR_WO().

Cc: Martin Schwidefsky <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Julian Wiedmann <[email protected]>
Cc: Ursula Braun <[email protected]>
Cc: Peter Oberparleiter <[email protected]>
Cc: Gerald Schaefer <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/s390/char/sclp.c | 12 ++++++------
drivers/s390/char/vmlogrdr.c | 7 ++-----
drivers/s390/net/ctcm_main.c | 6 +++---
drivers/s390/net/lcs.c | 6 +++---
drivers/s390/net/netiucv.c | 14 ++++++--------
drivers/s390/net/qeth_core_main.c | 6 +++---
6 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index 9c471ea1b99c..6111c1fa2d1e 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -1096,26 +1096,26 @@ static const struct dev_pm_ops sclp_pm_ops = {
.restore = sclp_restore,
};

-static ssize_t sclp_show_console_pages(struct device_driver *dev, char *buf)
+static ssize_t con_pages_show(struct device_driver *dev, char *buf)
{
return sprintf(buf, "%i\n", sclp_console_pages);
}

-static DRIVER_ATTR(con_pages, S_IRUSR, sclp_show_console_pages, NULL);
+static DRIVER_ATTR_RO(con_pages);

-static ssize_t sclp_show_con_drop(struct device_driver *dev, char *buf)
+static ssize_t con_drop_show(struct device_driver *dev, char *buf)
{
return sprintf(buf, "%i\n", sclp_console_drop);
}

-static DRIVER_ATTR(con_drop, S_IRUSR, sclp_show_con_drop, NULL);
+static DRIVER_ATTR_RO(con_drop);

-static ssize_t sclp_show_console_full(struct device_driver *dev, char *buf)
+static ssize_t con_full_show(struct device_driver *dev, char *buf)
{
return sprintf(buf, "%lu\n", sclp_console_full);
}

-static DRIVER_ATTR(con_full, S_IRUSR, sclp_show_console_full, NULL);
+static DRIVER_ATTR_RO(con_full);

static struct attribute *sclp_drv_attrs[] = {
&driver_attr_con_pages.attr,
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index 57974a1e0e03..b19020b9efff 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -641,10 +641,8 @@ static ssize_t vmlogrdr_recording_store(struct device * dev,
static DEVICE_ATTR(recording, 0200, NULL, vmlogrdr_recording_store);


-static ssize_t vmlogrdr_recording_status_show(struct device_driver *driver,
- char *buf)
+static ssize_t recording_status_show(struct device_driver *driver, char *buf)
{
-
static const char cp_command[] = "QUERY RECORDING ";
int len;

@@ -652,8 +650,7 @@ static ssize_t vmlogrdr_recording_status_show(struct device_driver *driver,
len = strlen(buf);
return len;
}
-static DRIVER_ATTR(recording_status, 0444, vmlogrdr_recording_status_show,
- NULL);
+static DRIVER_ATTR_RO(recording_status);
static struct attribute *vmlogrdr_drv_attrs[] = {
&driver_attr_recording_status.attr,
NULL,
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index 198842ce6876..b1fa38a6733f 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1770,15 +1770,15 @@ static struct ccwgroup_driver ctcm_group_driver = {
.restore = ctcm_pm_resume,
};

-static ssize_t ctcm_driver_group_store(struct device_driver *ddrv,
- const char *buf, size_t count)
+static ssize_t group_store(struct device_driver *ddrv, const char *buf,
+ size_t count)
{
int err;

err = ccwgroup_create_dev(ctcm_root_dev, &ctcm_group_driver, 2, buf);
return err ? err : count;
}
-static DRIVER_ATTR(group, 0200, NULL, ctcm_driver_group_store);
+static DRIVER_ATTR_WO(group);

static struct attribute *ctcm_drv_attrs[] = {
&driver_attr_group.attr,
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 211b31d9f157..589dba69db17 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -2411,14 +2411,14 @@ static struct ccwgroup_driver lcs_group_driver = {
.restore = lcs_restore,
};

-static ssize_t lcs_driver_group_store(struct device_driver *ddrv,
- const char *buf, size_t count)
+static ssize_t group_store(struct device_driver *ddrv, const char *buf,
+ size_t count)
{
int err;
err = ccwgroup_create_dev(lcs_root_dev, &lcs_group_driver, 2, buf);
return err ? err : count;
}
-static DRIVER_ATTR(group, 0200, NULL, lcs_driver_group_store);
+static DRIVER_ATTR_WO(group);

static struct attribute *lcs_drv_attrs[] = {
&driver_attr_group.attr,
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index dba94b486f05..fed9d6b56e5b 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -2020,8 +2020,8 @@ static struct net_device *netiucv_init_netdevice(char *username, char *userdata)
return NULL;
}

-static ssize_t conn_write(struct device_driver *drv,
- const char *buf, size_t count)
+static ssize_t connection_store(struct device_driver *drv, const char *buf,
+ size_t count)
{
char username[9];
char userdata[17];
@@ -2082,11 +2082,10 @@ static ssize_t conn_write(struct device_driver *drv,
netiucv_free_netdevice(dev);
return rc;
}
+static DRIVER_ATTR_WO(connection);

-static DRIVER_ATTR(connection, 0200, NULL, conn_write);
-
-static ssize_t remove_write (struct device_driver *drv,
- const char *buf, size_t count)
+static ssize_t remove_store(struct device_driver *drv, const char *buf,
+ size_t count)
{
struct iucv_connection *cp;
struct net_device *ndev;
@@ -2132,8 +2131,7 @@ static ssize_t remove_write (struct device_driver *drv,
IUCV_DBF_TEXT(data, 2, "remove_write: unknown device\n");
return -EINVAL;
}
-
-static DRIVER_ATTR(remove, 0200, NULL, remove_write);
+static DRIVER_ATTR_WO(remove);

static struct attribute * netiucv_drv_attrs[] = {
&driver_attr_connection.attr,
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index fc6d85f2b38d..462b82eb17a9 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5800,8 +5800,8 @@ static struct ccwgroup_driver qeth_core_ccwgroup_driver = {
.restore = qeth_core_restore,
};

-static ssize_t qeth_core_driver_group_store(struct device_driver *ddrv,
- const char *buf, size_t count)
+static ssize_t group_store(struct device_driver *ddrv, const char *buf,
+ size_t count)
{
int err;

@@ -5810,7 +5810,7 @@ static ssize_t qeth_core_driver_group_store(struct device_driver *ddrv,

return err ? err : count;
}
-static DRIVER_ATTR(group, 0200, NULL, qeth_core_driver_group_store);
+static DRIVER_ATTR_WO(group);

static struct attribute *qeth_drv_attrs[] = {
&driver_attr_group.attr,
--
2.13.1

2017-06-09 09:07:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 06/11] net: ehea: convert to use DRIVER_ATTR_RO

We are trying to get rid of DRIVER_ATTR(), and the ehea driver's
attribute can be trivially changed to use DRIVER_ATTR_RO().

Cc: Douglas Miller <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/net/ethernet/ibm/ehea/ehea_main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 1e53d7a82675..b9d310f20bcc 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -3553,14 +3553,12 @@ static int check_module_parm(void)
return ret;
}

-static ssize_t ehea_show_capabilities(struct device_driver *drv,
- char *buf)
+static ssize_t capabilities_show(struct device_driver *drv, char *buf)
{
return sprintf(buf, "%d", EHEA_CAPABILITIES);
}

-static DRIVER_ATTR(capabilities, S_IRUSR | S_IRGRP | S_IROTH,
- ehea_show_capabilities, NULL);
+static DRIVER_ATTR_RO(capabilities);

static int __init ehea_module_init(void)
{
--
2.13.1

2017-06-09 09:25:52

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 07/11] wireless: ipw2x00: convert to use DRIVER_ATTR_RW

Greg Kroah-Hartman <[email protected]> writes:

> We are trying to get rid of DRIVER_ATTR(), and the ipw2x00 driver's
> attributes can be trivially changed to use DRIVER_ATTR_RW().
>
> Cc: Stanislav Yakovlev <[email protected]>
> Cc: Kalle Valo <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Looks good to me. I assume that I should take this, but let me know if
you are planning to push this via your trees instead. Either way is fine
for me, I'm not expecting any conflicts here.

--
Kalle Valo

2017-06-09 09:34:46

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 07/11] wireless: ipw2x00: convert to use DRIVER_ATTR_RW

On Fri, Jun 09, 2017 at 12:25:44PM +0300, Kalle Valo wrote:
> Greg Kroah-Hartman <[email protected]> writes:
>
> > We are trying to get rid of DRIVER_ATTR(), and the ipw2x00 driver's
> > attributes can be trivially changed to use DRIVER_ATTR_RW().
> >
> > Cc: Stanislav Yakovlev <[email protected]>
> > Cc: Kalle Valo <[email protected]>
> > Cc: <[email protected]>
> > Cc: <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> Looks good to me. I assume that I should take this, but let me know if
> you are planning to push this via your trees instead. Either way is fine
> for me, I'm not expecting any conflicts here.

I can take it, thanks!

greg k-h

2017-06-09 09:35:40

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 09/11] platform: thinkpad_acpi: convert to use DRIVER_ATTR_RO/RW

On Fri, Jun 9, 2017 at 12:03 PM, Greg Kroah-Hartman
<[email protected]> wrote:
> We are trying to get rid of DRIVER_ATTR(), and the thinkpad_acpi
> driver's attributes can be trivially changed to use DRIVER_ATTR_RO() and
> DRIVER_ATTR_RW().

Which tree is it supposed to go through?
We might need an immutable tag / branch.

P.S. Change is good to me, though let's give a chance to Darren and
Henrique to comment.

> Cc: Henrique de Moraes Holschuh <[email protected]>
> Cc: Darren Hart <[email protected]>
> Cc: Andy Shevchenko <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
> drivers/platform/x86/thinkpad_acpi.c | 91 +++++++++++-------------------------
> 1 file changed, 28 insertions(+), 63 deletions(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index 7b6cb0c69b02..f6861b551178 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -1438,25 +1438,20 @@ static int tpacpi_rfk_procfs_write(const enum tpacpi_rfk_id id, char *buf)
> */
>
> /* interface_version --------------------------------------------------- */
> -static ssize_t tpacpi_driver_interface_version_show(
> - struct device_driver *drv,
> - char *buf)
> +static ssize_t interface_version_show(struct device_driver *drv, char *buf)
> {
> return snprintf(buf, PAGE_SIZE, "0x%08x\n", TPACPI_SYSFS_VERSION);
> }
> -
> -static DRIVER_ATTR(interface_version, S_IRUGO,
> - tpacpi_driver_interface_version_show, NULL);
> +static DRIVER_ATTR_RO(interface_version);
>
> /* debug_level --------------------------------------------------------- */
> -static ssize_t tpacpi_driver_debug_show(struct device_driver *drv,
> - char *buf)
> +static ssize_t debug_level_show(struct device_driver *drv, char *buf)
> {
> return snprintf(buf, PAGE_SIZE, "0x%04x\n", dbg_level);
> }
>
> -static ssize_t tpacpi_driver_debug_store(struct device_driver *drv,
> - const char *buf, size_t count)
> +static ssize_t debug_level_store(struct device_driver *drv, const char *buf,
> + size_t count)
> {
> unsigned long t;
>
> @@ -1467,34 +1462,28 @@ static ssize_t tpacpi_driver_debug_store(struct device_driver *drv,
>
> return count;
> }
> -
> -static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
> - tpacpi_driver_debug_show, tpacpi_driver_debug_store);
> +static DRIVER_ATTR_RW(debug_level);
>
> /* version ------------------------------------------------------------- */
> -static ssize_t tpacpi_driver_version_show(struct device_driver *drv,
> - char *buf)
> +static ssize_t version_show(struct device_driver *drv, char *buf)
> {
> return snprintf(buf, PAGE_SIZE, "%s v%s\n",
> TPACPI_DESC, TPACPI_VERSION);
> }
> -
> -static DRIVER_ATTR(version, S_IRUGO,
> - tpacpi_driver_version_show, NULL);
> +static DRIVER_ATTR_RO(version);
>
> /* --------------------------------------------------------------------- */
>
> #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
>
> /* wlsw_emulstate ------------------------------------------------------ */
> -static ssize_t tpacpi_driver_wlsw_emulstate_show(struct device_driver *drv,
> - char *buf)
> +static ssize_t wlsw_emulstate_show(struct device_driver *drv, char *buf)
> {
> return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_wlsw_emulstate);
> }
>
> -static ssize_t tpacpi_driver_wlsw_emulstate_store(struct device_driver *drv,
> - const char *buf, size_t count)
> +static ssize_t wlsw_emulstate_store(struct device_driver *drv, const char *buf,
> + size_t count)
> {
> unsigned long t;
>
> @@ -1508,22 +1497,16 @@ static ssize_t tpacpi_driver_wlsw_emulstate_store(struct device_driver *drv,
>
> return count;
> }
> -
> -static DRIVER_ATTR(wlsw_emulstate, S_IWUSR | S_IRUGO,
> - tpacpi_driver_wlsw_emulstate_show,
> - tpacpi_driver_wlsw_emulstate_store);
> +static DRIVER_ATTR_RW(wlsw_emulstate);
>
> /* bluetooth_emulstate ------------------------------------------------- */
> -static ssize_t tpacpi_driver_bluetooth_emulstate_show(
> - struct device_driver *drv,
> - char *buf)
> +static ssize_t bluetooth_emulstate_show(struct device_driver *drv, char *buf)
> {
> return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_bluetooth_emulstate);
> }
>
> -static ssize_t tpacpi_driver_bluetooth_emulstate_store(
> - struct device_driver *drv,
> - const char *buf, size_t count)
> +static ssize_t bluetooth_emulstate_store(struct device_driver *drv,
> + const char *buf, size_t count)
> {
> unsigned long t;
>
> @@ -1534,22 +1517,16 @@ static ssize_t tpacpi_driver_bluetooth_emulstate_store(
>
> return count;
> }
> -
> -static DRIVER_ATTR(bluetooth_emulstate, S_IWUSR | S_IRUGO,
> - tpacpi_driver_bluetooth_emulstate_show,
> - tpacpi_driver_bluetooth_emulstate_store);
> +static DRIVER_ATTR_RW(bluetooth_emulstate);
>
> /* wwan_emulstate ------------------------------------------------- */
> -static ssize_t tpacpi_driver_wwan_emulstate_show(
> - struct device_driver *drv,
> - char *buf)
> +static ssize_t wwan_emulstate_show(struct device_driver *drv, char *buf)
> {
> return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_wwan_emulstate);
> }
>
> -static ssize_t tpacpi_driver_wwan_emulstate_store(
> - struct device_driver *drv,
> - const char *buf, size_t count)
> +static ssize_t wwan_emulstate_store(struct device_driver *drv, const char *buf,
> + size_t count)
> {
> unsigned long t;
>
> @@ -1560,22 +1537,16 @@ static ssize_t tpacpi_driver_wwan_emulstate_store(
>
> return count;
> }
> -
> -static DRIVER_ATTR(wwan_emulstate, S_IWUSR | S_IRUGO,
> - tpacpi_driver_wwan_emulstate_show,
> - tpacpi_driver_wwan_emulstate_store);
> +static DRIVER_ATTR_RW(wwan_emulstate);
>
> /* uwb_emulstate ------------------------------------------------- */
> -static ssize_t tpacpi_driver_uwb_emulstate_show(
> - struct device_driver *drv,
> - char *buf)
> +static ssize_t uwb_emulstate_show(struct device_driver *drv, char *buf)
> {
> return snprintf(buf, PAGE_SIZE, "%d\n", !!tpacpi_uwb_emulstate);
> }
>
> -static ssize_t tpacpi_driver_uwb_emulstate_store(
> - struct device_driver *drv,
> - const char *buf, size_t count)
> +static ssize_t uwb_emulstate_store(struct device_driver *drv, const char *buf,
> + size_t count)
> {
> unsigned long t;
>
> @@ -1586,10 +1557,7 @@ static ssize_t tpacpi_driver_uwb_emulstate_store(
>
> return count;
> }
> -
> -static DRIVER_ATTR(uwb_emulstate, S_IWUSR | S_IRUGO,
> - tpacpi_driver_uwb_emulstate_show,
> - tpacpi_driver_uwb_emulstate_store);
> +static DRIVER_ATTR_RW(uwb_emulstate);
> #endif
>
> /* --------------------------------------------------------------------- */
> @@ -8606,14 +8574,13 @@ static ssize_t fan_fan2_input_show(struct device *dev,
> static DEVICE_ATTR(fan2_input, S_IRUGO, fan_fan2_input_show, NULL);
>
> /* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */
> -static ssize_t fan_fan_watchdog_show(struct device_driver *drv,
> - char *buf)
> +static ssize_t fan_watchdog_show(struct device_driver *drv, char *buf)
> {
> return snprintf(buf, PAGE_SIZE, "%u\n", fan_watchdog_maxinterval);
> }
>
> -static ssize_t fan_fan_watchdog_store(struct device_driver *drv,
> - const char *buf, size_t count)
> +static ssize_t fan_watchdog_store(struct device_driver *drv, const char *buf,
> + size_t count)
> {
> unsigned long t;
>
> @@ -8630,9 +8597,7 @@ static ssize_t fan_fan_watchdog_store(struct device_driver *drv,
>
> return count;
> }
> -
> -static DRIVER_ATTR(fan_watchdog, S_IWUSR | S_IRUGO,
> - fan_fan_watchdog_show, fan_fan_watchdog_store);
> +static DRIVER_ATTR_RW(fan_watchdog);
>
> /* --------------------------------------------------------------------- */
> static struct attribute *fan_attributes[] = {
> --
> 2.13.1
>



--
With Best Regards,
Andy Shevchenko

Subject: Re: [PATCH 09/11] platform: thinkpad_acpi: convert to use DRIVER_ATTR_RO/RW

On Fri, 09 Jun 2017, Greg Kroah-Hartman wrote:
> We are trying to get rid of DRIVER_ATTR(), and the thinkpad_acpi
> driver's attributes can be trivially changed to use DRIVER_ATTR_RO() and
> DRIVER_ATTR_RW().
>
> Cc: Henrique de Moraes Holschuh <[email protected]>
> Cc: Darren Hart <[email protected]>
> Cc: Andy Shevchenko <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Acked-by: Henrique de Moraes Holschuh <[email protected]>

--
Henrique Holschuh

2017-06-09 10:02:35

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 09/11] platform: thinkpad_acpi: convert to use DRIVER_ATTR_RO/RW

On Fri, Jun 09, 2017 at 12:35:35PM +0300, Andy Shevchenko wrote:
> On Fri, Jun 9, 2017 at 12:03 PM, Greg Kroah-Hartman
> <[email protected]> wrote:
> > We are trying to get rid of DRIVER_ATTR(), and the thinkpad_acpi
> > driver's attributes can be trivially changed to use DRIVER_ATTR_RO() and
> > DRIVER_ATTR_RW().
>
> Which tree is it supposed to go through?
> We might need an immutable tag / branch.

I can take it in my tree, sorry for not saying that in a 00/11 email, I
forgot that for this series.

thanks,

greg k-h

2017-06-09 10:11:49

by Heiko Carstens

[permalink] [raw]
Subject: Re: [PATCH 10/11] s390: drivers: convert to use DRIVER_ATTR_RO/WO

On Fri, Jun 09, 2017 at 11:03:13AM +0200, Greg Kroah-Hartman wrote:
> We are trying to get rid of DRIVER_ATTR(), and the s390 drivers'
> attributes can be trivially changed to use DRIVER_ATTR_RO() and
> DRIVER_ATTR_WO().
>
> Cc: Martin Schwidefsky <[email protected]>
> Cc: Heiko Carstens <[email protected]>
> Cc: Julian Wiedmann <[email protected]>
> Cc: Ursula Braun <[email protected]>
> Cc: Peter Oberparleiter <[email protected]>
> Cc: Gerald Schaefer <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
> drivers/s390/char/sclp.c | 12 ++++++------
> drivers/s390/char/vmlogrdr.c | 7 ++-----
> drivers/s390/net/ctcm_main.c | 6 +++---
> drivers/s390/net/lcs.c | 6 +++---
> drivers/s390/net/netiucv.c | 14 ++++++--------
> drivers/s390/net/qeth_core_main.c | 6 +++---
> 6 files changed, 23 insertions(+), 28 deletions(-)

I assume this will go upstream via your tree.

Acked-by: Heiko Carstens <[email protected]>

2017-06-09 10:20:52

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 10/11] s390: drivers: convert to use DRIVER_ATTR_RO/WO

On Fri, Jun 09, 2017 at 12:11:41PM +0200, Heiko Carstens wrote:
> On Fri, Jun 09, 2017 at 11:03:13AM +0200, Greg Kroah-Hartman wrote:
> > We are trying to get rid of DRIVER_ATTR(), and the s390 drivers'
> > attributes can be trivially changed to use DRIVER_ATTR_RO() and
> > DRIVER_ATTR_WO().
> >
> > Cc: Martin Schwidefsky <[email protected]>
> > Cc: Heiko Carstens <[email protected]>
> > Cc: Julian Wiedmann <[email protected]>
> > Cc: Ursula Braun <[email protected]>
> > Cc: Peter Oberparleiter <[email protected]>
> > Cc: Gerald Schaefer <[email protected]>
> > Cc: <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
> > ---
> > drivers/s390/char/sclp.c | 12 ++++++------
> > drivers/s390/char/vmlogrdr.c | 7 ++-----
> > drivers/s390/net/ctcm_main.c | 6 +++---
> > drivers/s390/net/lcs.c | 6 +++---
> > drivers/s390/net/netiucv.c | 14 ++++++--------
> > drivers/s390/net/qeth_core_main.c | 6 +++---
> > 6 files changed, 23 insertions(+), 28 deletions(-)
>
> I assume this will go upstream via your tree.

Yup, I can take it.

> Acked-by: Heiko Carstens <[email protected]>

Thanks for the review!

greg k-h

2017-06-09 15:23:40

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH 02/11] IB: nes: convert to use DRIVER_ATTR_RW

On Fri, 2017-06-09 at 11:03 +0200, Greg Kroah-Hartman wrote:
> We are trying to get rid of DRIVER_ATTR(), and all of the nes.c driver
> attributes can be trivially changed to use DRIVER_ATTR_RW(), making the
> code smaller and easier to manage over time.

Reviewed-by: Bart Van Assche <[email protected]>

2017-06-09 15:51:21

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH 11/11] USB: usbip: convert to use DRIVER_ATTR_RW

On 06/09/2017 03:03 AM, Greg Kroah-Hartman wrote:
> We are trying to get rid of DRIVER_ATTR(), and the usbip driver
> attribute can be trivially changed to use DRIVER_ATTR_RW().
>
> Cc: Valentina Manea <[email protected]>
> Cc: Shuah Khan <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Looks good to me.

Acked-by: Shuah Khan <[email protected]>

thanks,
-- Shuah

> ---
> drivers/usb/usbip/stub_main.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
> index 44ab43fc4fcc..e74fbb7f4a32 100644
> --- a/drivers/usb/usbip/stub_main.c
> +++ b/drivers/usb/usbip/stub_main.c
> @@ -134,7 +134,7 @@ int del_match_busid(char *busid)
> return ret;
> }
>
> -static ssize_t show_match_busid(struct device_driver *drv, char *buf)
> +static ssize_t match_busid_show(struct device_driver *drv, char *buf)
> {
> int i;
> char *out = buf;
> @@ -149,7 +149,7 @@ static ssize_t show_match_busid(struct device_driver *drv, char *buf)
> return out - buf;
> }
>
> -static ssize_t store_match_busid(struct device_driver *dev, const char *buf,
> +static ssize_t match_busid_store(struct device_driver *dev, const char *buf,
> size_t count)
> {
> int len;
> @@ -181,8 +181,7 @@ static ssize_t store_match_busid(struct device_driver *dev, const char *buf,
>
> return -EINVAL;
> }
> -static DRIVER_ATTR(match_busid, S_IRUSR | S_IWUSR, show_match_busid,
> - store_match_busid);
> +static DRIVER_ATTR_RW(match_busid);
>
> static ssize_t rebind_store(struct device_driver *dev, const char *buf,
> size_t count)
>

2017-06-09 16:20:07

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 06/11] net: ehea: convert to use DRIVER_ATTR_RO

From: Greg Kroah-Hartman <[email protected]>
Date: Fri, 9 Jun 2017 11:03:09 +0200

> We are trying to get rid of DRIVER_ATTR(), and the ehea driver's
> attribute can be trivially changed to use DRIVER_ATTR_RO().
>
> Cc: Douglas Miller <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Acked-by: David S. Miller <[email protected]>

2017-06-09 16:20:18

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 05/11] net: caif: convert to use DRIVER_ATTR_RO

From: Greg Kroah-Hartman <[email protected]>
Date: Fri, 9 Jun 2017 11:03:08 +0200

> We are trying to get rid of DRIVER_ATTR(), and the caif driver's
> attributes can be trivially changed to use DRIVER_ATTR_RO().
>
> Cc: Dmitry Tarnyagin <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Acked-by: David S. Miller <[email protected]>

2017-06-10 00:50:39

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH 09/11] platform: thinkpad_acpi: convert to use DRIVER_ATTR_RO/RW

On Fri, Jun 09, 2017 at 12:02:25PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Jun 09, 2017 at 12:35:35PM +0300, Andy Shevchenko wrote:
> > On Fri, Jun 9, 2017 at 12:03 PM, Greg Kroah-Hartman
> > <[email protected]> wrote:
> > > We are trying to get rid of DRIVER_ATTR(), and the thinkpad_acpi
> > > driver's attributes can be trivially changed to use DRIVER_ATTR_RO() and
> > > DRIVER_ATTR_RW().
> >
> > Which tree is it supposed to go through?
> > We might need an immutable tag / branch.
>
> I can take it in my tree, sorry for not saying that in a 00/11 email, I
> forgot that for this series.

OK, no dependencies that I see, but it's a simple mechanical change. Happy for
it to go through Greg's tree.

Reviewed-by: Darren Hart (VMware) <[email protected]>

--
Darren Hart
VMware Open Source Technology Center