Commit 23680f0b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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 <axboe@kernel.dk>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Russ Weight <russell.h.weight@intel.com>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Raed Salem <raeds@nvidia.com>
Cc: Chen Zhongjin <chenzhongjin@huawei.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Avihai Horon <avihaih@nvidia.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Colin Ian King <colin.i.king@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Jakob Koschel <jakobkoschel@gmail.com>
Cc: Antoine Tenart <atenart@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Wang Yufen <wangyufen@huawei.com>
Cc: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: linux-nvme@lists.infradead.org
Cc: linux-pm@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Acked-by: default avatarSebastian Reichel <sre@kernel.org>
Acked-by: default avatarRafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20221123122523.1332370-1-gregkh@linuxfoundation.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2613cc29
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1181,9 +1181,9 @@ static void disk_release(struct device *dev)
	iput(disk->part0->bd_inode);	/* frees the disk */
}

static int block_uevent(struct device *dev, struct kobj_uevent_env *env)
static int block_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
	struct gendisk *disk = dev_to_disk(dev);
	const struct gendisk *disk = dev_to_disk(dev);

	return add_uevent_var(env, "DISKSEQ=%llu", disk->diskseq);
}
+3 −3
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ static struct attribute *firmware_class_attrs[] = {
};
ATTRIBUTE_GROUPS(firmware_class);

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

static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
static int firmware_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
	struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev);
	const struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev);
	int err = 0;

	mutex_lock(&fw_lock);
+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ struct fw_sysfs {
	void *fw_upload_priv;
};

static inline struct fw_sysfs *to_fw_sysfs(struct device *dev)
static inline struct fw_sysfs *to_fw_sysfs(const struct device *dev)
{
	return container_of(dev, struct fw_sysfs, dev);
}
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ static const struct attribute_group* sys_dmi_attribute_groups[] = {
	NULL
};

static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
	ssize_t len;

+3 −3
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ static const char * const gnss_type_names[GNSS_TYPE_COUNT] = {
	[GNSS_TYPE_MTK]		= "MTK",
};

static const char *gnss_type_name(struct gnss_device *gdev)
static const char *gnss_type_name(const struct gnss_device *gdev)
{
	const char *name = NULL;

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

static int gnss_uevent(struct device *dev, struct kobj_uevent_env *env)
static int gnss_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
	struct gnss_device *gdev = to_gnss_device(dev);
	const struct gnss_device *gdev = to_gnss_device(dev);
	int ret;

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