mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
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: Alex Shi <alexs@kernel.org> Acked-by: Iwona Winiarska <iwona.winiarska@intel.com> Acked-by: Dan Williams <dan.j.williams@intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> # pci Acked-by: Wei 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.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9cc61e5fbd
commit
75cff725d9
@ -125,8 +125,8 @@ Exporting Attributes
|
||||
|
||||
struct bus_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct bus_type *, char * buf);
|
||||
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
|
||||
ssize_t (*show)(const struct bus_type *, char * buf);
|
||||
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
|
||||
|
@ -373,8 +373,8 @@ Structure::
|
||||
|
||||
struct bus_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct bus_type *, char * buf);
|
||||
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
|
||||
ssize_t (*show)(const struct bus_type *, char * buf);
|
||||
ssize_t (*store)(const struct bus_type *, const char * buf, size_t count);
|
||||
};
|
||||
|
||||
Declaring::
|
||||
|
@ -329,8 +329,8 @@ void device_remove_file(struct device *dev, const struct device_attribute * attr
|
||||
|
||||
struct bus_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct bus_type *, char * buf);
|
||||
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
|
||||
ssize_t (*show)(const struct bus_type *, char * buf);
|
||||
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
|
||||
|
||||
struct bus_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct bus_type *, char * buf);
|
||||
ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
|
||||
ssize_t (*show)(const struct bus_type *, char * buf);
|
||||
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)
|
||||
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 *dev;
|
||||
@ -305,7 +305,7 @@ out:
|
||||
}
|
||||
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;
|
||||
char *path;
|
||||
|
@ -1006,7 +1006,7 @@ ATTRIBUTE_GROUPS(vio_cmo_dev);
|
||||
/* sysfs bus functions and data structures for CMO */
|
||||
|
||||
#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); \
|
||||
} \
|
||||
@ -1015,7 +1015,7 @@ static struct bus_attribute bus_attr_cmo_bus_##name = \
|
||||
|
||||
#define viobus_cmo_pool_rd_attr(name, var) \
|
||||
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); \
|
||||
} \
|
||||
@ -1030,12 +1030,12 @@ viobus_cmo_pool_rd_attr(reserve, size);
|
||||
viobus_cmo_pool_rd_attr(excess, size);
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
@ -554,8 +554,7 @@ void pata_parport_unregister_driver(struct pi_protocol *pr)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pata_parport_unregister_driver);
|
||||
|
||||
static ssize_t new_device_store(struct bus_type *bus, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t new_device_store(const struct bus_type *bus, const char *buf, size_t count)
|
||||
{
|
||||
char port[12] = "auto";
|
||||
char protocol[8] = "auto";
|
||||
@ -630,8 +629,7 @@ static void pi_remove_one(struct device *dev)
|
||||
/* pata_parport_dev_release will do kfree(pi) */
|
||||
}
|
||||
|
||||
static ssize_t delete_device_store(struct bus_type *bus, const char *buf,
|
||||
size_t count)
|
||||
static ssize_t delete_device_store(const struct bus_type *bus, const char *buf, size_t count)
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
|
@ -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 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);
|
||||
int ret;
|
||||
@ -287,7 +287,7 @@ static ssize_t drivers_autoprobe_show(struct bus_type *bus, char *buf)
|
||||
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)
|
||||
{
|
||||
struct subsys_private *sp = bus_to_subsys(bus);
|
||||
@ -304,7 +304,7 @@ static ssize_t drivers_autoprobe_store(struct bus_type *bus,
|
||||
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)
|
||||
{
|
||||
struct device *dev;
|
||||
@ -808,7 +808,7 @@ static void klist_devices_put(struct klist_node *n)
|
||||
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)
|
||||
{
|
||||
struct subsys_private *sp = bus_to_subsys(bus);
|
||||
|
@ -491,12 +491,12 @@ static bool single_major = true;
|
||||
module_param(single_major, bool, 0444);
|
||||
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 remove_store(struct bus_type *bus, const char *buf,
|
||||
static ssize_t add_store(const 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);
|
||||
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);
|
||||
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);
|
||||
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)
|
||||
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);
|
||||
}
|
||||
@ -6967,9 +6967,7 @@ err_out_format:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t do_rbd_add(struct bus_type *bus,
|
||||
const char *buf,
|
||||
size_t count)
|
||||
static ssize_t do_rbd_add(const char *buf, size_t count)
|
||||
{
|
||||
struct rbd_device *rbd_dev = NULL;
|
||||
struct ceph_options *ceph_opts = NULL;
|
||||
@ -7081,18 +7079,18 @@ err_out_args:
|
||||
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)
|
||||
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)
|
||||
{
|
||||
return do_rbd_add(bus, buf, count);
|
||||
return do_rbd_add(buf, count);
|
||||
}
|
||||
|
||||
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,
|
||||
const char *buf,
|
||||
size_t count)
|
||||
static ssize_t do_rbd_remove(const char *buf, size_t count)
|
||||
{
|
||||
struct rbd_device *rbd_dev = NULL;
|
||||
struct list_head *tmp;
|
||||
@ -7196,18 +7192,18 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
|
||||
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)
|
||||
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)
|
||||
{
|
||||
return do_rbd_remove(bus, buf, count);
|
||||
return do_rbd_remove(buf, count);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -231,7 +231,7 @@ exit:
|
||||
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)
|
||||
{
|
||||
unsigned long val;
|
||||
@ -284,7 +284,7 @@ exit:
|
||||
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)
|
||||
{
|
||||
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,
|
||||
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);
|
||||
return strlen(buf);
|
||||
|
@ -1927,7 +1927,7 @@ bool schedule_cxl_memdev_detach(struct cxl_memdev *cxlmd)
|
||||
EXPORT_SYMBOL_NS_GPL(schedule_cxl_memdev_detach, CXL);
|
||||
|
||||
/* 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")) {
|
||||
flush_workqueue(cxl_bus_wq);
|
||||
|
@ -684,7 +684,7 @@ static const struct attribute_group vmbus_dev_group = {
|
||||
__ATTRIBUTE_GROUPS(vmbus_dev);
|
||||
|
||||
/* 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());
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ static struct nsim_bus_dev *
|
||||
nsim_bus_dev_new(unsigned int id, unsigned int port_count, unsigned int num_queues);
|
||||
|
||||
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;
|
||||
struct nsim_bus_dev *nsim_bus_dev;
|
||||
@ -186,7 +186,7 @@ static BUS_ATTR_WO(new_device);
|
||||
static void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev);
|
||||
|
||||
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;
|
||||
unsigned int id;
|
||||
|
@ -428,7 +428,7 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
|
||||
}
|
||||
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;
|
||||
struct pci_bus *b = NULL;
|
||||
|
@ -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;
|
||||
|
||||
@ -6691,7 +6691,7 @@ static ssize_t resource_alignment_show(struct bus_type *bus, char *buf)
|
||||
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)
|
||||
{
|
||||
char *param, *old, *end;
|
||||
|
@ -15,7 +15,7 @@ static int rescan_controller(struct device *dev, void *data)
|
||||
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;
|
||||
int ret;
|
||||
|
@ -286,7 +286,7 @@ const struct attribute_group *rio_dev_groups[] = {
|
||||
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;
|
||||
int rc;
|
||||
|
@ -1166,12 +1166,12 @@ EXPORT_SYMBOL(ap_parse_mask_str);
|
||||
* 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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int domain;
|
||||
@ -1193,7 +1193,7 @@ static ssize_t ap_domain_store(struct bus_type *bus,
|
||||
|
||||
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 */
|
||||
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)
|
||||
|
||||
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 */
|
||||
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)
|
||||
|
||||
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 */
|
||||
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)
|
||||
|
||||
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",
|
||||
ap_irq_flag ? 1 : 0);
|
||||
@ -1246,12 +1246,12 @@ static ssize_t ap_interrupts_show(struct bus_type *bus, char *buf)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int time;
|
||||
@ -1265,12 +1265,12 @@ static ssize_t config_time_store(struct bus_type *bus,
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int flag, rc;
|
||||
@ -1289,12 +1289,12 @@ static ssize_t poll_thread_store(struct bus_type *bus,
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
unsigned long long time;
|
||||
@ -1318,21 +1318,21 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf,
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -1393,7 +1393,7 @@ static int apmask_commit(unsigned long *newapm)
|
||||
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)
|
||||
{
|
||||
int rc, changes = 0;
|
||||
@ -1425,7 +1425,7 @@ done:
|
||||
|
||||
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;
|
||||
|
||||
@ -1486,7 +1486,7 @@ static int aqmask_commit(unsigned long *newaqm)
|
||||
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)
|
||||
{
|
||||
int rc, changes = 0;
|
||||
@ -1518,13 +1518,13 @@ done:
|
||||
|
||||
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",
|
||||
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)
|
||||
{
|
||||
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,
|
||||
|
||||
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;
|
||||
unsigned int apqns, n;
|
||||
|
@ -659,17 +659,17 @@ static const struct device_type fcoe_fcf_device_type = {
|
||||
.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)
|
||||
{
|
||||
return fcoe_ctlr_create_store(bus, buf, count);
|
||||
return fcoe_ctlr_create_store(buf, count);
|
||||
}
|
||||
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)
|
||||
{
|
||||
return fcoe_ctlr_destroy_store(bus, buf, count);
|
||||
return fcoe_ctlr_destroy_store(buf, count);
|
||||
}
|
||||
static BUS_ATTR_WO(ctlr_destroy);
|
||||
|
||||
|
@ -745,8 +745,7 @@ static int libfcoe_device_notification(struct notifier_block *notifier,
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
|
||||
const char *buf, size_t count)
|
||||
ssize_t fcoe_ctlr_create_store(const char *buf, size_t count)
|
||||
{
|
||||
struct net_device *netdev = NULL;
|
||||
struct fcoe_transport *ft = NULL;
|
||||
@ -808,8 +807,7 @@ out_nodev:
|
||||
return count;
|
||||
}
|
||||
|
||||
ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
|
||||
const char *buf, size_t count)
|
||||
ssize_t fcoe_ctlr_destroy_store(const char *buf, size_t count)
|
||||
{
|
||||
int rc = -ENODEV;
|
||||
struct net_device *netdev = NULL;
|
||||
|
@ -118,8 +118,8 @@ extern int __must_check bus_rescan_devices(struct bus_type *bus);
|
||||
|
||||
struct bus_attribute {
|
||||
struct attribute attr;
|
||||
ssize_t (*show)(struct bus_type *bus, char *buf);
|
||||
ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
|
||||
ssize_t (*show)(const struct bus_type *bus, char *buf);
|
||||
ssize_t (*store)(const struct bus_type *bus, const char *buf, size_t count);
|
||||
};
|
||||
|
||||
#define BUS_ATTR_RW(_name) \
|
||||
|
@ -397,10 +397,8 @@ int fcoe_transport_attach(struct fcoe_transport *ft);
|
||||
int fcoe_transport_detach(struct fcoe_transport *ft);
|
||||
|
||||
/* sysfs store handler for ctrl_control interface */
|
||||
ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
|
||||
const char *buf, size_t count);
|
||||
ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
|
||||
const char *buf, size_t count);
|
||||
ssize_t fcoe_ctlr_create_store(const char *buf, size_t count);
|
||||
ssize_t fcoe_ctlr_destroy_store(const char *buf, size_t count);
|
||||
|
||||
#endif /* _LIBFCOE_H */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user