Skip to content

Commit 23680f0

Browse files
committed
driver core: make struct class.dev_uevent() take a const *
The dev_uevent() in struct class should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into all relevant subsystems that use this callback. Cc: Jens Axboe <[email protected]> Cc: Luis Chamberlain <[email protected]> Cc: Russ Weight <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Johan Hovold <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Leon Romanovsky <[email protected]> Cc: Karsten Keil <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Keith Busch <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Sagi Grimberg <[email protected]> Cc: Dominik Brodowski <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Wolfram Sang <[email protected]> Cc: Raed Salem <[email protected]> Cc: Chen Zhongjin <[email protected]> Cc: Tetsuo Handa <[email protected]> Cc: Avihai Horon <[email protected]> Cc: "Matthew Wilcox (Oracle)" <[email protected]> Cc: Alan Stern <[email protected]> Cc: Colin Ian King <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Jakob Koschel <[email protected]> Cc: Antoine Tenart <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Wang Yufen <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Acked-by: Sebastian Reichel <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2613cc2 commit 23680f0

File tree

18 files changed

+33
-33
lines changed

18 files changed

+33
-33
lines changed

block/genhd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,9 +1181,9 @@ static void disk_release(struct device *dev)
11811181
iput(disk->part0->bd_inode); /* frees the disk */
11821182
}
11831183

1184-
static int block_uevent(struct device *dev, struct kobj_uevent_env *env)
1184+
static int block_uevent(const struct device *dev, struct kobj_uevent_env *env)
11851185
{
1186-
struct gendisk *disk = dev_to_disk(dev);
1186+
const struct gendisk *disk = dev_to_disk(dev);
11871187

11881188
return add_uevent_var(env, "DISKSEQ=%llu", disk->diskseq);
11891189
}

drivers/base/firmware_loader/sysfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static struct attribute *firmware_class_attrs[] = {
6464
};
6565
ATTRIBUTE_GROUPS(firmware_class);
6666

67-
static int do_firmware_uevent(struct fw_sysfs *fw_sysfs, struct kobj_uevent_env *env)
67+
static int do_firmware_uevent(const struct fw_sysfs *fw_sysfs, struct kobj_uevent_env *env)
6868
{
6969
if (add_uevent_var(env, "FIRMWARE=%s", fw_sysfs->fw_priv->fw_name))
7070
return -ENOMEM;
@@ -76,9 +76,9 @@ static int do_firmware_uevent(struct fw_sysfs *fw_sysfs, struct kobj_uevent_env
7676
return 0;
7777
}
7878

79-
static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
79+
static int firmware_uevent(const struct device *dev, struct kobj_uevent_env *env)
8080
{
81-
struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev);
81+
const struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev);
8282
int err = 0;
8383

8484
mutex_lock(&fw_lock);

drivers/base/firmware_loader/sysfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct fw_sysfs {
8181
void *fw_upload_priv;
8282
};
8383

84-
static inline struct fw_sysfs *to_fw_sysfs(struct device *dev)
84+
static inline struct fw_sysfs *to_fw_sysfs(const struct device *dev)
8585
{
8686
return container_of(dev, struct fw_sysfs, dev);
8787
}

drivers/firmware/dmi-id.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static const struct attribute_group* sys_dmi_attribute_groups[] = {
155155
NULL
156156
};
157157

158-
static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
158+
static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
159159
{
160160
ssize_t len;
161161

drivers/gnss/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static const char * const gnss_type_names[GNSS_TYPE_COUNT] = {
337337
[GNSS_TYPE_MTK] = "MTK",
338338
};
339339

340-
static const char *gnss_type_name(struct gnss_device *gdev)
340+
static const char *gnss_type_name(const struct gnss_device *gdev)
341341
{
342342
const char *name = NULL;
343343

@@ -365,9 +365,9 @@ static struct attribute *gnss_attrs[] = {
365365
};
366366
ATTRIBUTE_GROUPS(gnss);
367367

368-
static int gnss_uevent(struct device *dev, struct kobj_uevent_env *env)
368+
static int gnss_uevent(const struct device *dev, struct kobj_uevent_env *env)
369369
{
370-
struct gnss_device *gdev = to_gnss_device(dev);
370+
const struct gnss_device *gdev = to_gnss_device(dev);
371371
int ret;
372372

373373
ret = add_uevent_var(env, "GNSS_TYPE=%s", gnss_type_name(gdev));

drivers/infiniband/core/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static void ib_device_release(struct device *device)
511511
kfree_rcu(dev, rcu_head);
512512
}
513513

514-
static int ib_device_uevent(struct device *device,
514+
static int ib_device_uevent(const struct device *device,
515515
struct kobj_uevent_env *env)
516516
{
517517
if (add_uevent_var(env, "NAME=%s", dev_name(device)))

drivers/isdn/mISDN/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ static struct attribute *mISDN_attrs[] = {
139139
};
140140
ATTRIBUTE_GROUPS(mISDN);
141141

142-
static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env)
142+
static int mISDN_uevent(const struct device *dev, struct kobj_uevent_env *env)
143143
{
144-
struct mISDNdevice *mdev = dev_to_mISDN(dev);
144+
const struct mISDNdevice *mdev = dev_to_mISDN(dev);
145145

146146
if (!mdev)
147147
return 0;

drivers/media/dvb-core/dvbdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,9 +1008,9 @@ void dvb_module_release(struct i2c_client *client)
10081008
EXPORT_SYMBOL_GPL(dvb_module_release);
10091009
#endif
10101010

1011-
static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
1011+
static int dvb_uevent(const struct device *dev, struct kobj_uevent_env *env)
10121012
{
1013-
struct dvb_device *dvbdev = dev_get_drvdata(dev);
1013+
const struct dvb_device *dvbdev = dev_get_drvdata(dev);
10141014

10151015
add_uevent_var(env, "DVB_ADAPTER_NUM=%d", dvbdev->adapter->num);
10161016
add_uevent_var(env, "DVB_DEVICE_TYPE=%s", dnames[dvbdev->type]);

drivers/nvme/host/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4580,9 +4580,9 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
45804580
}
45814581
EXPORT_SYMBOL_GPL(nvme_remove_namespaces);
45824582

4583-
static int nvme_class_uevent(struct device *dev, struct kobj_uevent_env *env)
4583+
static int nvme_class_uevent(const struct device *dev, struct kobj_uevent_env *env)
45844584
{
4585-
struct nvme_ctrl *ctrl =
4585+
const struct nvme_ctrl *ctrl =
45864586
container_of(dev, struct nvme_ctrl, ctrl_device);
45874587
struct nvmf_ctrl_options *opts = ctrl->opts;
45884588
int ret;

drivers/pcmcia/cs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,10 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
810810
EXPORT_SYMBOL(pcmcia_reset_card);
811811

812812

813-
static int pcmcia_socket_uevent(struct device *dev,
813+
static int pcmcia_socket_uevent(const struct device *dev,
814814
struct kobj_uevent_env *env)
815815
{
816-
struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
816+
const struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
817817

818818
if (add_uevent_var(env, "SOCKET_NO=%u", s->sock))
819819
return -ENOMEM;

0 commit comments

Comments
 (0)