Commit 75cff725 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

driver core: bus: mark the struct bus_type for sysfs callbacks as constant

struct bus_type should never be modified in a sysfs callback as there is
nothing in the structure to modify, and frankly, the structure is almost
never used in a sysfs callback, so mark it as constant to allow struct
bus_type to be moved to read-only memory.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Cc: Alison Schofield <alison.schofield@intel.com>
Cc: Ben Widawsky <bwidawsk@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Harald Freudenberger <freude@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Hu Haowen <src.res@email.cn>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Stuart Yoder <stuyoder@gmail.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Yanteng Si <siyanteng@loongson.cn>
Acked-by: Ilya Dryomov <idryomov@gmail.com> # rbd
Acked-by: Ira Weiny <ira.weiny@intel.com> # cxl
Reviewed-by: default avatarAlex Shi <alexs@kernel.org>
Acked-by: default avatarIwona Winiarska <iwona.winiarska@intel.com>
Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>	# pci
Acked-by: default avatarWei Liu <wei.liu@kernel.org>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com> # scsi
Link: https://lore.kernel.org/r/20230313182918.1312597-23-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9cc61e5f
...@@ -125,8 +125,8 @@ Exporting Attributes ...@@ -125,8 +125,8 @@ Exporting Attributes
struct bus_attribute { struct bus_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf); ssize_t (*show)(const struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count); ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
}; };
Bus drivers can export attributes using the BUS_ATTR_RW macro that works Bus drivers can export attributes using the BUS_ATTR_RW macro that works
......
...@@ -373,8 +373,8 @@ Structure:: ...@@ -373,8 +373,8 @@ Structure::
struct bus_attribute { struct bus_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf); ssize_t (*show)(const struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count); ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
}; };
Declaring:: Declaring::
......
...@@ -329,8 +329,8 @@ void device_remove_file(struct device *dev, const struct device_attribute * attr ...@@ -329,8 +329,8 @@ void device_remove_file(struct device *dev, const struct device_attribute * attr
struct bus_attribute { struct bus_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf); ssize_t (*show)(const struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count); ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
}; };
声明: 声明:
......
...@@ -332,8 +332,8 @@ void device_remove_file(struct device *dev, const struct device_attribute * attr ...@@ -332,8 +332,8 @@ void device_remove_file(struct device *dev, const struct device_attribute * attr
struct bus_attribute { struct bus_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct bus_type *, char * buf); ssize_t (*show)(const struct bus_type *, char * buf);
ssize_t (*store)(struct bus_type *, const char * buf, size_t count); ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
}; };
聲明: 聲明:
......
...@@ -267,7 +267,7 @@ static char *ibmebus_chomp(const char *in, size_t count) ...@@ -267,7 +267,7 @@ static char *ibmebus_chomp(const char *in, size_t count)
return out; return out;
} }
static ssize_t probe_store(struct bus_type *bus, const char *buf, size_t count) static ssize_t probe_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
struct device_node *dn = NULL; struct device_node *dn = NULL;
struct device *dev; struct device *dev;
...@@ -305,7 +305,7 @@ static ssize_t probe_store(struct bus_type *bus, const char *buf, size_t count) ...@@ -305,7 +305,7 @@ static ssize_t probe_store(struct bus_type *bus, const char *buf, size_t count)
} }
static BUS_ATTR_WO(probe); static BUS_ATTR_WO(probe);
static ssize_t remove_store(struct bus_type *bus, const char *buf, size_t count) static ssize_t remove_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
struct device *dev; struct device *dev;
char *path; char *path;
......
...@@ -1006,7 +1006,7 @@ ATTRIBUTE_GROUPS(vio_cmo_dev); ...@@ -1006,7 +1006,7 @@ ATTRIBUTE_GROUPS(vio_cmo_dev);
/* sysfs bus functions and data structures for CMO */ /* sysfs bus functions and data structures for CMO */
#define viobus_cmo_rd_attr(name) \ #define viobus_cmo_rd_attr(name) \
static ssize_t cmo_bus_##name##_show(struct bus_type *bt, char *buf) \ static ssize_t cmo_bus_##name##_show(const struct bus_type *bt, char *buf) \
{ \ { \
return sprintf(buf, "%lu\n", vio_cmo.name); \ return sprintf(buf, "%lu\n", vio_cmo.name); \
} \ } \
...@@ -1015,7 +1015,7 @@ static struct bus_attribute bus_attr_cmo_bus_##name = \ ...@@ -1015,7 +1015,7 @@ static struct bus_attribute bus_attr_cmo_bus_##name = \
#define viobus_cmo_pool_rd_attr(name, var) \ #define viobus_cmo_pool_rd_attr(name, var) \
static ssize_t \ static ssize_t \
cmo_##name##_##var##_show(struct bus_type *bt, char *buf) \ cmo_##name##_##var##_show(const struct bus_type *bt, char *buf) \
{ \ { \
return sprintf(buf, "%lu\n", vio_cmo.name.var); \ return sprintf(buf, "%lu\n", vio_cmo.name.var); \
} \ } \
...@@ -1030,12 +1030,12 @@ viobus_cmo_pool_rd_attr(reserve, size); ...@@ -1030,12 +1030,12 @@ viobus_cmo_pool_rd_attr(reserve, size);
viobus_cmo_pool_rd_attr(excess, size); viobus_cmo_pool_rd_attr(excess, size);
viobus_cmo_pool_rd_attr(excess, free); viobus_cmo_pool_rd_attr(excess, free);
static ssize_t cmo_high_show(struct bus_type *bt, char *buf) static ssize_t cmo_high_show(const struct bus_type *bt, char *buf)
{ {
return sprintf(buf, "%lu\n", vio_cmo.high); return sprintf(buf, "%lu\n", vio_cmo.high);
} }
static ssize_t cmo_high_store(struct bus_type *bt, const char *buf, static ssize_t cmo_high_store(const struct bus_type *bt, const char *buf,
size_t count) size_t count)
{ {
unsigned long flags; unsigned long flags;
......
...@@ -554,8 +554,7 @@ void pata_parport_unregister_driver(struct pi_protocol *pr) ...@@ -554,8 +554,7 @@ void pata_parport_unregister_driver(struct pi_protocol *pr)
} }
EXPORT_SYMBOL_GPL(pata_parport_unregister_driver); EXPORT_SYMBOL_GPL(pata_parport_unregister_driver);
static ssize_t new_device_store(struct bus_type *bus, const char *buf, static ssize_t new_device_store(const struct bus_type *bus, const char *buf, size_t count)
size_t count)
{ {
char port[12] = "auto"; char port[12] = "auto";
char protocol[8] = "auto"; char protocol[8] = "auto";
...@@ -630,8 +629,7 @@ static void pi_remove_one(struct device *dev) ...@@ -630,8 +629,7 @@ static void pi_remove_one(struct device *dev)
/* pata_parport_dev_release will do kfree(pi) */ /* pata_parport_dev_release will do kfree(pi) */
} }
static ssize_t delete_device_store(struct bus_type *bus, const char *buf, static ssize_t delete_device_store(const struct bus_type *bus, const char *buf, size_t count)
size_t count)
{ {
struct device *dev; struct device *dev;
......
...@@ -274,7 +274,7 @@ static ssize_t bind_store(struct device_driver *drv, const char *buf, ...@@ -274,7 +274,7 @@ static ssize_t bind_store(struct device_driver *drv, const char *buf,
} }
static DRIVER_ATTR_IGNORE_LOCKDEP(bind, 0200, NULL, bind_store); static DRIVER_ATTR_IGNORE_LOCKDEP(bind, 0200, NULL, bind_store);
static ssize_t drivers_autoprobe_show(struct bus_type *bus, char *buf) static ssize_t drivers_autoprobe_show(const struct bus_type *bus, char *buf)
{ {
struct subsys_private *sp = bus_to_subsys(bus); struct subsys_private *sp = bus_to_subsys(bus);
int ret; int ret;
...@@ -287,7 +287,7 @@ static ssize_t drivers_autoprobe_show(struct bus_type *bus, char *buf) ...@@ -287,7 +287,7 @@ static ssize_t drivers_autoprobe_show(struct bus_type *bus, char *buf)
return ret; return ret;
} }
static ssize_t drivers_autoprobe_store(struct bus_type *bus, static ssize_t drivers_autoprobe_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct subsys_private *sp = bus_to_subsys(bus); struct subsys_private *sp = bus_to_subsys(bus);
...@@ -304,7 +304,7 @@ static ssize_t drivers_autoprobe_store(struct bus_type *bus, ...@@ -304,7 +304,7 @@ static ssize_t drivers_autoprobe_store(struct bus_type *bus,
return count; return count;
} }
static ssize_t drivers_probe_store(struct bus_type *bus, static ssize_t drivers_probe_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct device *dev; struct device *dev;
...@@ -808,7 +808,7 @@ static void klist_devices_put(struct klist_node *n) ...@@ -808,7 +808,7 @@ static void klist_devices_put(struct klist_node *n)
put_device(dev); put_device(dev);
} }
static ssize_t bus_uevent_store(struct bus_type *bus, static ssize_t bus_uevent_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct subsys_private *sp = bus_to_subsys(bus); struct subsys_private *sp = bus_to_subsys(bus);
......
...@@ -491,12 +491,12 @@ static bool single_major = true; ...@@ -491,12 +491,12 @@ static bool single_major = true;
module_param(single_major, bool, 0444); module_param(single_major, bool, 0444);
MODULE_PARM_DESC(single_major, "Use a single major number for all rbd devices (default: true)"); MODULE_PARM_DESC(single_major, "Use a single major number for all rbd devices (default: true)");
static ssize_t add_store(struct bus_type *bus, const char *buf, size_t count); static ssize_t add_store(const struct bus_type *bus, const char *buf, size_t count);
static ssize_t remove_store(struct bus_type *bus, const char *buf, static ssize_t remove_store(const struct bus_type *bus, const char *buf,
size_t count); size_t count);
static ssize_t add_single_major_store(struct bus_type *bus, const char *buf, static ssize_t add_single_major_store(const struct bus_type *bus, const char *buf,
size_t count); size_t count);
static ssize_t remove_single_major_store(struct bus_type *bus, const char *buf, static ssize_t remove_single_major_store(const struct bus_type *bus, const char *buf,
size_t count); size_t count);
static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth); static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth);
...@@ -538,7 +538,7 @@ static bool rbd_is_lock_owner(struct rbd_device *rbd_dev) ...@@ -538,7 +538,7 @@ static bool rbd_is_lock_owner(struct rbd_device *rbd_dev)
return is_lock_owner; return is_lock_owner;
} }
static ssize_t supported_features_show(struct bus_type *bus, char *buf) static ssize_t supported_features_show(const struct bus_type *bus, char *buf)
{ {
return sprintf(buf, "0x%llx\n", RBD_FEATURES_SUPPORTED); return sprintf(buf, "0x%llx\n", RBD_FEATURES_SUPPORTED);
} }
...@@ -6967,9 +6967,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) ...@@ -6967,9 +6967,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth)
return ret; return ret;
} }
static ssize_t do_rbd_add(struct bus_type *bus, static ssize_t do_rbd_add(const char *buf, size_t count)
const char *buf,
size_t count)
{ {
struct rbd_device *rbd_dev = NULL; struct rbd_device *rbd_dev = NULL;
struct ceph_options *ceph_opts = NULL; struct ceph_options *ceph_opts = NULL;
...@@ -7081,18 +7079,18 @@ static ssize_t do_rbd_add(struct bus_type *bus, ...@@ -7081,18 +7079,18 @@ static ssize_t do_rbd_add(struct bus_type *bus,
goto out; goto out;
} }
static ssize_t add_store(struct bus_type *bus, const char *buf, size_t count) static ssize_t add_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
if (single_major) if (single_major)
return -EINVAL; return -EINVAL;
return do_rbd_add(bus, buf, count); return do_rbd_add(buf, count);
} }
static ssize_t add_single_major_store(struct bus_type *bus, const char *buf, static ssize_t add_single_major_store(const struct bus_type *bus, const char *buf,
size_t count) size_t count)
{ {
return do_rbd_add(bus, buf, count); return do_rbd_add(buf, count);
} }
static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) static void rbd_dev_remove_parent(struct rbd_device *rbd_dev)
...@@ -7122,9 +7120,7 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) ...@@ -7122,9 +7120,7 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev)
} }
} }
static ssize_t do_rbd_remove(struct bus_type *bus, static ssize_t do_rbd_remove(const char *buf, size_t count)
const char *buf,
size_t count)
{ {
struct rbd_device *rbd_dev = NULL; struct rbd_device *rbd_dev = NULL;
struct list_head *tmp; struct list_head *tmp;
...@@ -7196,18 +7192,18 @@ static ssize_t do_rbd_remove(struct bus_type *bus, ...@@ -7196,18 +7192,18 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
return count; return count;
} }
static ssize_t remove_store(struct bus_type *bus, const char *buf, size_t count) static ssize_t remove_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
if (single_major) if (single_major)
return -EINVAL; return -EINVAL;
return do_rbd_remove(bus, buf, count); return do_rbd_remove(buf, count);
} }
static ssize_t remove_single_major_store(struct bus_type *bus, const char *buf, static ssize_t remove_single_major_store(const struct bus_type *bus, const char *buf,
size_t count) size_t count)
{ {
return do_rbd_remove(bus, buf, count); return do_rbd_remove(buf, count);
} }
/* /*
......
...@@ -231,7 +231,7 @@ static int scan_fsl_mc_bus(struct device *dev, void *data) ...@@ -231,7 +231,7 @@ static int scan_fsl_mc_bus(struct device *dev, void *data)
return 0; return 0;
} }
static ssize_t rescan_store(struct bus_type *bus, static ssize_t rescan_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned long val;
...@@ -284,7 +284,7 @@ static int fsl_mc_bus_get_autorescan(struct device *dev, void *data) ...@@ -284,7 +284,7 @@ static int fsl_mc_bus_get_autorescan(struct device *dev, void *data)
return 0; return 0;
} }
static ssize_t autorescan_store(struct bus_type *bus, static ssize_t autorescan_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
bus_for_each_dev(bus, NULL, (void *)buf, fsl_mc_bus_set_autorescan); bus_for_each_dev(bus, NULL, (void *)buf, fsl_mc_bus_set_autorescan);
...@@ -292,7 +292,7 @@ static ssize_t autorescan_store(struct bus_type *bus, ...@@ -292,7 +292,7 @@ static ssize_t autorescan_store(struct bus_type *bus,
return count; return count;
} }
static ssize_t autorescan_show(struct bus_type *bus, char *buf) static ssize_t autorescan_show(const struct bus_type *bus, char *buf)
{ {
bus_for_each_dev(bus, NULL, (void *)buf, fsl_mc_bus_get_autorescan); bus_for_each_dev(bus, NULL, (void *)buf, fsl_mc_bus_get_autorescan);
return strlen(buf); return strlen(buf);
......
...@@ -1927,7 +1927,7 @@ bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd) ...@@ -1927,7 +1927,7 @@ bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd)
EXPORT_SYMBOL_NS_GPL(schedule_cxl_memdev_detach, CXL); EXPORT_SYMBOL_NS_GPL(schedule_cxl_memdev_detach, CXL);
/* for user tooling to ensure port disable work has completed */ /* for user tooling to ensure port disable work has completed */
static ssize_t flush_store(struct bus_type *bus, const char *buf, size_t count) static ssize_t flush_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
if (sysfs_streq(buf, "1")) { if (sysfs_streq(buf, "1")) {
flush_workqueue(cxl_bus_wq); flush_workqueue(cxl_bus_wq);
......
...@@ -684,7 +684,7 @@ static const struct attribute_group vmbus_dev_group = { ...@@ -684,7 +684,7 @@ static const struct attribute_group vmbus_dev_group = {
__ATTRIBUTE_GROUPS(vmbus_dev); __ATTRIBUTE_GROUPS(vmbus_dev);
/* Set up the attribute for /sys/bus/vmbus/hibernation */ /* Set up the attribute for /sys/bus/vmbus/hibernation */
static ssize_t hibernation_show(struct bus_type *bus, char *buf) static ssize_t hibernation_show(const struct bus_type *bus, char *buf)
{ {
return sprintf(buf, "%d\n", !!hv_is_hibernation_supported()); return sprintf(buf, "%d\n", !!hv_is_hibernation_supported());
} }
......
...@@ -132,7 +132,7 @@ static struct nsim_bus_dev * ...@@ -132,7 +132,7 @@ static struct nsim_bus_dev *
nsim_bus_dev_new(unsigned int id, unsigned int port_count, unsigned int num_queues); nsim_bus_dev_new(unsigned int id, unsigned int port_count, unsigned int num_queues);
static ssize_t static ssize_t
new_device_store(struct bus_type *bus, const char *buf, size_t count) new_device_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
unsigned int id, port_count, num_queues; unsigned int id, port_count, num_queues;
struct nsim_bus_dev *nsim_bus_dev; struct nsim_bus_dev *nsim_bus_dev;
...@@ -186,7 +186,7 @@ static BUS_ATTR_WO(new_device); ...@@ -186,7 +186,7 @@ static BUS_ATTR_WO(new_device);
static void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev); static void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev);
static ssize_t static ssize_t
del_device_store(struct bus_type *bus, const char *buf, size_t count) del_device_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
struct nsim_bus_dev *nsim_bus_dev, *tmp; struct nsim_bus_dev *nsim_bus_dev, *tmp;
unsigned int id; unsigned int id;
......
...@@ -428,7 +428,7 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr, ...@@ -428,7 +428,7 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
} }
static DEVICE_ATTR_RW(msi_bus); static DEVICE_ATTR_RW(msi_bus);
static ssize_t rescan_store(struct bus_type *bus, const char *buf, size_t count) static ssize_t rescan_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
unsigned long val; unsigned long val;
struct pci_bus *b = NULL; struct pci_bus *b = NULL;
......
...@@ -6679,7 +6679,7 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) ...@@ -6679,7 +6679,7 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
} }
} }
static ssize_t resource_alignment_show(struct bus_type *bus, char *buf) static ssize_t resource_alignment_show(const struct bus_type *bus, char *buf)
{ {
size_t count = 0; size_t count = 0;
...@@ -6691,7 +6691,7 @@ static ssize_t resource_alignment_show(struct bus_type *bus, char *buf) ...@@ -6691,7 +6691,7 @@ static ssize_t resource_alignment_show(struct bus_type *bus, char *buf)
return count; return count;
} }
static ssize_t resource_alignment_store(struct bus_type *bus, static ssize_t resource_alignment_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
char *param, *old, *end; char *param, *old, *end;
......
...@@ -15,7 +15,7 @@ static int rescan_controller(struct device *dev, void *data) ...@@ -15,7 +15,7 @@ static int rescan_controller(struct device *dev, void *data)
return peci_controller_scan_devices(to_peci_controller(dev)); return peci_controller_scan_devices(to_peci_controller(dev));
} }
static ssize_t rescan_store(struct bus_type *bus, const char *buf, size_t count) static ssize_t rescan_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
bool res; bool res;
int ret; int ret;
......
...@@ -286,7 +286,7 @@ const struct attribute_group *rio_dev_groups[] = { ...@@ -286,7 +286,7 @@ const struct attribute_group *rio_dev_groups[] = {
NULL, NULL,
}; };
static ssize_t scan_store(struct bus_type *bus, const char *buf, size_t count) static ssize_t scan_store(const struct bus_type *bus, const char *buf, size_t count)
{ {
long val; long val;
int rc; int rc;
......
...@@ -1166,12 +1166,12 @@ EXPORT_SYMBOL(ap_parse_mask_str); ...@@ -1166,12 +1166,12 @@ EXPORT_SYMBOL(ap_parse_mask_str);
* AP bus attributes. * AP bus attributes.
*/ */
static ssize_t ap_domain_show(struct bus_type *bus, char *buf) static ssize_t ap_domain_show(const struct bus_type *bus, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", ap_domain_index); return scnprintf(buf, PAGE_SIZE, "%d\n", ap_domain_index);
} }
static ssize_t ap_domain_store(struct bus_type *bus, static ssize_t ap_domain_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int domain; int domain;
...@@ -1193,7 +1193,7 @@ static ssize_t ap_domain_store(struct bus_type *bus, ...@@ -1193,7 +1193,7 @@ static ssize_t ap_domain_store(struct bus_type *bus,
static BUS_ATTR_RW(ap_domain); static BUS_ATTR_RW(ap_domain);
static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf) static ssize_t ap_control_domain_mask_show(const struct bus_type *bus, char *buf)
{ {
if (!ap_qci_info) /* QCI not supported */ if (!ap_qci_info) /* QCI not supported */
return scnprintf(buf, PAGE_SIZE, "not supported\n"); return scnprintf(buf, PAGE_SIZE, "not supported\n");
...@@ -1208,7 +1208,7 @@ static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf) ...@@ -1208,7 +1208,7 @@ static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf)
static BUS_ATTR_RO(ap_control_domain_mask); static BUS_ATTR_RO(ap_control_domain_mask);
static ssize_t ap_usage_domain_mask_show(struct bus_type *bus, char *buf) static ssize_t ap_usage_domain_mask_show(const struct bus_type *bus, char *buf)
{ {
if (!ap_qci_info) /* QCI not supported */ if (!ap_qci_info) /* QCI not supported */
return scnprintf(buf, PAGE_SIZE, "not supported\n"); return scnprintf(buf, PAGE_SIZE, "not supported\n");
...@@ -1223,7 +1223,7 @@ static ssize_t ap_usage_domain_mask_show(struct bus_type *bus, char *buf) ...@@ -1223,7 +1223,7 @@ static ssize_t ap_usage_domain_mask_show(struct bus_type *bus, char *buf)
static BUS_ATTR_RO(ap_usage_domain_mask); static BUS_ATTR_RO(ap_usage_domain_mask);
static ssize_t ap_adapter_mask_show(struct bus_type *bus, char *buf) static ssize_t ap_adapter_mask_show(const struct bus_type *bus, char *buf)
{ {
if (!ap_qci_info) /* QCI not supported */ if (!ap_qci_info) /* QCI not supported */
return scnprintf(buf, PAGE_SIZE, "not supported\n"); return scnprintf(buf, PAGE_SIZE, "not supported\n");
...@@ -1238,7 +1238,7 @@ static ssize_t ap_adapter_mask_show(struct bus_type *bus, char *buf) ...@@ -1238,7 +1238,7 @@ static ssize_t ap_adapter_mask_show(struct bus_type *bus, char *buf)
static BUS_ATTR_RO(ap_adapter_mask); static BUS_ATTR_RO(ap_adapter_mask);
static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf) static ssize_t ap_interrupts_show(const struct bus_type *bus, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", return scnprintf(buf, PAGE_SIZE, "%d\n",
ap_irq_flag ? 1 : 0); ap_irq_flag ? 1 : 0);
...@@ -1246,12 +1246,12 @@ static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf) ...@@ -1246,12 +1246,12 @@ static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf)
static BUS_ATTR_RO(ap_interrupts); static BUS_ATTR_RO(ap_interrupts);
static ssize_t config_time_show(struct bus_type *bus, char *buf) static ssize_t config_time_show(const struct bus_type *bus, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", ap_config_time); return scnprintf(buf, PAGE_SIZE, "%d\n", ap_config_time);
} }
static ssize_t config_time_store(struct bus_type *bus, static ssize_t config_time_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int time; int time;
...@@ -1265,12 +1265,12 @@ static ssize_t config_time_store(struct bus_type *bus, ...@@ -1265,12 +1265,12 @@ static ssize_t config_time_store(struct bus_type *bus,
static BUS_ATTR_RW(config_time); static BUS_ATTR_RW(config_time);
static ssize_t poll_thread_show(struct bus_type *bus, char *buf) static ssize_t poll_thread_show(const struct bus_type *bus, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", ap_poll_kthread ? 1 : 0); return scnprintf(buf, PAGE_SIZE, "%d\n", ap_poll_kthread ? 1 : 0);
} }
static ssize_t poll_thread_store(struct bus_type *bus, static ssize_t poll_thread_store(const struct bus_type *bus,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int flag, rc; int flag, rc;
...@@ -1289,12 +1289,12 @@ static ssize_t poll_thread_store(struct bus_type *bus, ...@@ -1289,12 +1289,12 @@ static ssize_t poll_thread_store(struct bus_type *bus,
static BUS_ATTR_RW(poll_thread); static BUS_ATTR_RW(poll_thread);
static ssize_t poll_timeout_show(struct bus_type *bus, char *buf) static ssize_t poll_timeout_show(const struct bus_type *bus, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%llu\n", poll_timeout); return scnprintf(buf, PAGE_SIZE, "%llu\n", poll_timeout);
} }
static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf, static ssize_t poll_timeout_store(const struct bus_type *bus, const char *buf,
size_t count) size_t count)
{ {
unsigned long long time; unsigned long long time;
...@@ -1318,21 +1318,21 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf, ...@@ -1318,21 +1318,21 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf,
static BUS_ATTR_RW(poll_timeout); static BUS_ATTR_RW(poll_timeout);
static ssize_t ap_max_domain_id_show(struct bus_type *bus, char *buf) static ssize_t ap_max_domain_id_show(const struct bus_type *bus, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", ap_max_domain_id); return scnprintf(buf, PAGE_SIZE, "%d\n", ap_max_domain_id);
} }
static BUS_ATTR_RO(ap_max_domain_id); static BUS_ATTR_RO(ap_max_domain_id);
static ssize_t ap_max_adapter_id_show(struct bus_type *bus, char *buf) static ssize_t ap_max_adapter_id_show(const struct bus_type *bus, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", ap_max_adapter_id); return scnprintf(buf, PAGE_SIZE, "%d\n", ap_max_adapter_id);
} }
static BUS_ATTR_RO(ap_max_adapter_id); static BUS_ATTR_RO(ap_max_adapter_id);
static ssize_t apmask_show(struct bus_type *bus, char *buf) static ssize_t apmask_show(const struct bus_type *bus, char *buf)
{ {
int rc; int rc;
...@@ -1393,7 +1393,7 @@ static int apmask_commit(unsigned long *newapm) ...@@ -1393,7 +1393,7 @@ static int apmask_commit(unsigned long *newapm)
return 0; return 0;
} }
static ssize_t apmask_store(struct bus_type *bus, const char *buf, static ssize_t apmask_store(const struct bus_type *bus, const char *buf,
size_t count) size_t count)
{ {
int rc, changes = 0; int rc, changes = 0;
...@@ -1425,7 +1425,7 @@ static ssize_t apmask_store(struct bus_type *bus, const char *buf, ...@@ -1425,7 +1425,7 @@ static ssize_t apmask_store(struct bus_type *bus, const char *buf,
static BUS_ATTR_RW(apmask); static BUS_ATTR_RW(apmask);
static ssize_t aqmask_show(struct bus_type *bus, char *buf) static ssize_t aqmask_show(const struct bus_type *bus, char *buf)
{ {
int rc; int rc;
...@@ -1486,7 +1486,7 @@ static int aqmask_commit(unsigned long *newaqm) ...@@ -1486,7 +1486,7 @@ static int aqmask_commit(unsigned long *newaqm)
return 0; return 0;
} }
static ssize_t aqmask_store(struct bus_type *bus, const char *buf, static ssize_t aqmask_store(const struct bus_type *bus, const char *buf,
size_t count) size_t count)
{ {
int rc, changes = 0; int rc, changes = 0;
...@@ -1518,13 +1518,13 @@ static ssize_t aqmask_store(struct bus_type *bus, const char *buf, ...@@ -1518,13 +1518,13 @@ static ssize_t aqmask_store(struct bus_type *bus, const char *buf,
static BUS_ATTR_RW(aqmask); static BUS_ATTR_RW(aqmask);
static ssize_t scans_show(struct bus_type *bus, char *buf) static ssize_t scans_show(const struct bus_type *bus, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%llu\n", return scnprintf(buf, PAGE_SIZE, "%llu\n",
atomic64_read(&ap_scan_bus_count)); atomic64_read(&ap_scan_bus_count));
} }
static ssize_t scans_store(struct bus_type *bus, const char *buf, static ssize_t scans_store(const struct bus_type *bus, const char *buf,
size_t count) size_t count)
{ {
AP_DBF_INFO("%s force AP bus rescan\n", __func__); AP_DBF_INFO("%s force AP bus rescan\n", __func__);
...@@ -1536,7 +1536,7 @@ static ssize_t scans_store(struct bus_type *bus, const char *buf, ...@@ -1536,7 +1536,7 @@ static ssize_t scans_store(struct bus_type *bus, const char *buf,
static BUS_ATTR_RW(scans); static BUS_ATTR_RW(scans);
static ssize_t bindings_show(struct bus_type *bus, char *buf) static ssize_t bindings_show(const struct bus_type *bus, char *buf)
{ {
int rc; int rc;
unsigned int apqns, n; unsigned int apqns, n;
......
...@@ -659,17 +659,17 @@ static const struct device_type fcoe_fcf_device_type = { ...@@ -659,17 +659,17 @@ static const struct device_type fcoe_fcf_device_type = {
.release = fcoe_fcf_device_release, .release = fcoe_fcf_device_release,
}; };
static ssize_t ctlr_create_store(struct bus_type *bus, const char *buf, static ssize_t ctlr_create_store(const struct bus_type *bus, const char *buf,
size_t count) size_t count)
{ {
return fcoe_ctlr_create_store(bus, buf, count); return fcoe_ctlr_create_store(buf, count);
} }
static BUS_ATTR_WO(ctlr_create); static BUS_ATTR_WO(ctlr_create);
static ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf, static ssize_t ctlr_destroy_store(const struct bus_type *bus, const char *buf,
size_t count) size_t count)
{ {
return fcoe_ctlr_destroy_store(bus, buf, count); return fcoe_ctlr_destroy_store(buf, count);
} }
static BUS_ATTR_WO(ctlr_destroy); static BUS_ATTR_WO(ctlr_destroy);
......
...@@ -745,8 +745,7 @@ static int libfcoe_device_notification(struct notifier_block *notifier, ...@@ -745,8 +745,7 @@ static int libfcoe_device_notification(struct notifier_block *notifier,
return NOTIFY_OK; return NOTIFY_OK;
} }
ssize_t fcoe_ctlr_create_store(struct bus_type *bus, ssize_t fcoe_ctlr_create_store(const char *buf, size_t count)
const char *buf, size_t count)
{ {
struct net_device *netdev = NULL; struct net_device *netdev = NULL;
struct fcoe_transport *ft = NULL; struct fcoe_transport *ft = NULL;
...@@ -808,8 +807,7 @@ ssize_t fcoe_ctlr_create_store(struct bus_type *bus, ...@@ -808,8 +807,7 @@ ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
return count; return count;
} }
ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus, ssize_t fcoe_ctlr_destroy_store(const char *buf, size_t count)
const char *buf, size_t count)
{ {
int rc = -ENODEV; int rc = -ENODEV;
struct net_device *netdev = NULL; struct net_device *netdev = NULL;
......
...@@ -118,8 +118,8 @@ extern int __must_check bus_rescan_devices(struct bus_type *bus); ...@@ -118,8 +118,8 @@ extern int __must_check bus_rescan_devices(struct bus_type *bus);
struct bus_attribute { struct bus_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct bus_type *bus, char *buf); ssize_t (*show)(const struct bus_type *bus, char *buf);
ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count); ssize_t (*store)(const struct bus_type *bus, const char *buf, size_t count);
}; };
#define BUS_ATTR_RW(_name) \ #define BUS_ATTR_RW(_name) \
......
...@@ -397,10 +397,8 @@ int fcoe_transport_attach(struct fcoe_transport *ft); ...@@ -397,10 +397,8 @@ int fcoe_transport_attach(struct fcoe_transport *ft);
int fcoe_transport_detach(struct fcoe_transport *ft); int fcoe_transport_detach(struct fcoe_transport *ft);
/* sysfs store handler for ctrl_control interface */ /* sysfs store handler for ctrl_control interface */
ssize_t fcoe_ctlr_create_store(struct bus_type *bus, ssize_t fcoe_ctlr_create_store(const char *buf, size_t count);
const char *buf, size_t count); ssize_t fcoe_ctlr_destroy_store(const char *buf, size_t count);
ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
const char *buf, size_t count);
#endif /* _LIBFCOE_H */ #endif /* _LIBFCOE_H */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment