]> Git Repo - linux.git/commitdiff
driver core: make struct class.devnode() take a const *
authorGreg Kroah-Hartman <[email protected]>
Wed, 23 Nov 2022 12:25:20 +0000 (13:25 +0100)
committerGreg Kroah-Hartman <[email protected]>
Thu, 24 Nov 2022 16:12:27 +0000 (17:12 +0100)
The devnode() 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: Fenghua Yu <[email protected]>
Cc: Reinette Chatre <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: [email protected]
Cc: "H. Peter Anvin" <[email protected]>
Cc: FUJITA Tomonori <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Justin Sanders <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Sumit Semwal <[email protected]>
Cc: Benjamin Gaignard <[email protected]>
Cc: Liam Mark <[email protected]>
Cc: Laura Abbott <[email protected]>
Cc: Brian Starkey <[email protected]>
Cc: John Stultz <[email protected]>
Cc: "Christian König" <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: Dennis Dalessandro <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Sean Young <[email protected]>
Cc: Frank Haverkamp <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: Cornelia Huck <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Anton Vorontsov <[email protected]>
Cc: Colin Cross <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Christophe JAILLET <[email protected]>
Cc: Xie Yongji <[email protected]>
Cc: Gautam Dawar <[email protected]>
Cc: Dan Carpenter <[email protected]>
Cc: Eli Cohen <[email protected]>
Cc: Parav Pandit <[email protected]>
Cc: Maxime Coquelin <[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]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
24 files changed:
arch/x86/kernel/cpu/resctrl/pseudo_lock.c
arch/x86/kernel/cpuid.c
arch/x86/kernel/msr.c
block/bsg.c
drivers/block/aoe/aoechr.c
drivers/char/mem.c
drivers/char/misc.c
drivers/dma-buf/dma-heap.c
drivers/gpu/drm/drm_sysfs.c
drivers/infiniband/core/user_mad.c
drivers/infiniband/core/uverbs_main.c
drivers/infiniband/hw/hfi1/device.c
drivers/input/input.c
drivers/media/dvb-core/dvbdev.c
drivers/media/pci/ddbridge/ddbridge-core.c
drivers/media/rc/rc-main.c
drivers/misc/genwqe/card_base.c
drivers/tty/tty_io.c
drivers/usb/core/file.c
drivers/vdpa/vdpa_user/vduse_dev.c
drivers/vfio/vfio_main.c
fs/pstore/pmsg.c
include/linux/device/class.h
sound/sound_core.c

index d961ae3ed96e720e1a346bf1775abee9bfbe83a5..4e4231a58f383e48b9a81572e3410e280a27c757 100644 (file)
@@ -1560,9 +1560,9 @@ static const struct file_operations pseudo_lock_dev_fops = {
        .mmap =         pseudo_lock_dev_mmap,
 };
 
-static char *pseudo_lock_devnode(struct device *dev, umode_t *mode)
+static char *pseudo_lock_devnode(const struct device *dev, umode_t *mode)
 {
-       struct rdtgroup *rdtgrp;
+       const struct rdtgroup *rdtgrp;
 
        rdtgrp = dev_get_drvdata(dev);
        if (mode)
index 6f7b8cc1bc9fa342a66ed021e38aaba4927f750d..621ba9c0f17a9d53cccd156b7bf633bdb0f9979b 100644 (file)
@@ -139,7 +139,7 @@ static int cpuid_device_destroy(unsigned int cpu)
        return 0;
 }
 
-static char *cpuid_devnode(struct device *dev, umode_t *mode)
+static char *cpuid_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt));
 }
index ed8ac6bcbafb2fd8b18af132622199628295eb46..7087513117861e8f3e6f21a27240525ccb0b27fd 100644 (file)
@@ -250,7 +250,7 @@ static int msr_device_destroy(unsigned int cpu)
        return 0;
 }
 
-static char *msr_devnode(struct device *dev, umode_t *mode)
+static char *msr_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
 }
index 2ab1351eb082395e6070f73dde7a55ba1729b5c2..08046bd9207d8866008a6552b297865b3adbeba5 100644 (file)
@@ -232,7 +232,7 @@ out_put_device:
 }
 EXPORT_SYMBOL_GPL(bsg_register_queue);
 
-static char *bsg_devnode(struct device *dev, umode_t *mode)
+static char *bsg_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "bsg/%s", dev_name(dev));
 }
index 8eea2529da20a7ec76efade7937ad91b6e0aee7c..7a368c90467d1cd038c896640e82dada88007956 100644 (file)
@@ -273,7 +273,7 @@ static const struct file_operations aoe_fops = {
        .llseek = noop_llseek,
 };
 
-static char *aoe_devnode(struct device *dev, umode_t *mode)
+static char *aoe_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev));
 }
index 5611d127363e470ec8185b42dd025196b4e076b8..83bf2a4dcb57ed848c9b6b61f56b57a95925f94a 100644 (file)
@@ -746,7 +746,7 @@ static const struct file_operations memory_fops = {
        .llseek = noop_llseek,
 };
 
-static char *mem_devnode(struct device *dev, umode_t *mode)
+static char *mem_devnode(const struct device *dev, umode_t *mode)
 {
        if (mode && devlist[MINOR(dev->devt)].mode)
                *mode = devlist[MINOR(dev->devt)].mode;
index cba19bfdc44ddb5c082e681d7526dce723b43ac6..88c6995b9a3d13cef3a8c38ebdce22204b607220 100644 (file)
@@ -254,9 +254,9 @@ void misc_deregister(struct miscdevice *misc)
 }
 EXPORT_SYMBOL(misc_deregister);
 
-static char *misc_devnode(struct device *dev, umode_t *mode)
+static char *misc_devnode(const struct device *dev, umode_t *mode)
 {
-       struct miscdevice *c = dev_get_drvdata(dev);
+       const struct miscdevice *c = dev_get_drvdata(dev);
 
        if (mode && c->mode)
                *mode = c->mode;
index 8f5848aa144fec35a2de2ea68558c27dc3083669..4d7150791315aa721741e0d1452871960cffa4a4 100644 (file)
@@ -299,7 +299,7 @@ err0:
        return err_ret;
 }
 
-static char *dma_heap_devnode(struct device *dev, umode_t *mode)
+static char *dma_heap_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "dma_heap/%s", dev_name(dev));
 }
index 430e00b16eecabaa23fdab006ae2a4e1d5254eea..14bf156b3f1ba58eba51394a91854bd832827653 100644 (file)
@@ -90,7 +90,7 @@ static void drm_sysfs_acpi_register(void) { }
 static void drm_sysfs_acpi_unregister(void) { }
 #endif
 
-static char *drm_devnode(struct device *dev, umode_t *mode)
+static char *drm_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
 }
index 98cb594cd9a699bbf4ddb27267a440130826efe6..f83954180a338997b7b7775d5d9ab719b5d79fa3 100644 (file)
@@ -1224,7 +1224,7 @@ static struct attribute *umad_class_dev_attrs[] = {
 };
 ATTRIBUTE_GROUPS(umad_class_dev);
 
-static char *umad_devnode(struct device *dev, umode_t *mode)
+static char *umad_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
 }
index d544340887277368c6be58897be2f94b96ea850c..bdb179a09d77cfc35b9a13c66161dfcade4a3ff5 100644 (file)
@@ -1237,7 +1237,7 @@ static void ib_uverbs_remove_one(struct ib_device *device, void *client_data)
        put_device(&uverbs_dev->dev);
 }
 
-static char *uverbs_devnode(struct device *dev, umode_t *mode)
+static char *uverbs_devnode(const struct device *dev, umode_t *mode)
 {
        if (mode)
                *mode = 0666;
index 8ceff7141bafeb871bc9d71cc232d11c83818bb3..1f44960321704a31df18d7b1fd033e15b5d5d1e4 100644 (file)
@@ -72,7 +72,7 @@ const char *class_name(void)
        return hfi1_class_name;
 }
 
-static char *hfi1_devnode(struct device *dev, umode_t *mode)
+static char *hfi1_devnode(const struct device *dev, umode_t *mode)
 {
        if (mode)
                *mode = 0600;
@@ -85,7 +85,7 @@ static const char *class_name_user(void)
        return hfi1_class_name_user;
 }
 
-static char *hfi1_user_devnode(struct device *dev, umode_t *mode)
+static char *hfi1_user_devnode(const struct device *dev, umode_t *mode)
 {
        if (mode)
                *mode = 0666;
index ebb2b7f0f8ff46ec72943e05c94f442aea098e0a..50597165dc54fa7f5716b89dac9caf7f0233cfb4 100644 (file)
@@ -1913,7 +1913,7 @@ static const struct device_type input_dev_type = {
 #endif
 };
 
-static char *input_devnode(struct device *dev, umode_t *mode)
+static char *input_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev));
 }
index 6ef18bab9648b015fabddbc60fc380842c811778..e73f5240cc2cc362208258e771be2e64e8f3e924 100644 (file)
@@ -1018,9 +1018,9 @@ static int dvb_uevent(const struct device *dev, struct kobj_uevent_env *env)
        return 0;
 }
 
-static char *dvb_devnode(struct device *dev, umode_t *mode)
+static char *dvb_devnode(const struct device *dev, umode_t *mode)
 {
-       struct dvb_device *dvbdev = dev_get_drvdata(dev);
+       const struct dvb_device *dvbdev = dev_get_drvdata(dev);
 
        return kasprintf(GFP_KERNEL, "dvb/adapter%d/%s%d",
                dvbdev->adapter->num, dnames[dvbdev->type], dvbdev->id);
index fe833f39698afb42f125c7bf7a1e56a08815c310..ee8087f29b2c4af379bf4ab60f0103c6f177c8ad 100644 (file)
@@ -2716,9 +2716,9 @@ static const struct file_operations ddb_fops = {
        .release        = ddb_release,
 };
 
-static char *ddb_devnode(struct device *device, umode_t *mode)
+static char *ddb_devnode(const struct device *device, umode_t *mode)
 {
-       struct ddb *dev = dev_get_drvdata(device);
+       const struct ddb *dev = dev_get_drvdata(device);
 
        return kasprintf(GFP_KERNEL, "ddbridge/card%d", dev->nr);
 }
index eba0cd30e314d75ee826e7db3b751a4993160e5b..527d9324742bb394aa7a855d492900bde375a4a9 100644 (file)
@@ -1017,7 +1017,7 @@ static void ir_close(struct input_dev *idev)
 }
 
 /* class for /sys/class/rc */
-static char *rc_devnode(struct device *dev, umode_t *mode)
+static char *rc_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev));
 }
index 693981891870c4c5920aa66fd4e377d1fa9aa8e6..0f00687f72d4302977fa53f90d98cc1261695105 100644 (file)
@@ -1349,7 +1349,7 @@ static struct pci_driver genwqe_driver = {
  * Default mode should be rw for everybody. Do not change default
  * device name.
  */
-static char *genwqe_devnode(struct device *dev, umode_t *mode)
+static char *genwqe_devnode(const struct device *dev, umode_t *mode)
 {
        if (mode)
                *mode = 0666;
index de06c3c2ff70ac79a7bd5dff790611534d3f2da6..aad8171f6c2146780ff24ed765ea37507ffc7055 100644 (file)
@@ -3494,7 +3494,7 @@ void tty_default_fops(struct file_operations *fops)
        *fops = tty_fops;
 }
 
-static char *tty_devnode(struct device *dev, umode_t *mode)
+static char *tty_devnode(const struct device *dev, umode_t *mode)
 {
        if (!mode)
                return NULL;
index 558890ada0e5bdcf8c573af0cc5be59c52c99ef1..da7d88e069e6c098ec1823013cb8b15d5ff53787 100644 (file)
@@ -62,7 +62,7 @@ static struct usb_class {
        struct class *class;
 } *usb_class;
 
-static char *usb_devnode(struct device *dev, umode_t *mode)
+static char *usb_devnode(const struct device *dev, umode_t *mode)
 {
        struct usb_class_driver *drv;
 
index 35dceee3ed56086af3e105a9451dc91b8af5d743..0dd3c1f291da30cb8be62ac7742a841195ad22dd 100644 (file)
@@ -1656,7 +1656,7 @@ static const struct file_operations vduse_ctrl_fops = {
        .llseek         = noop_llseek,
 };
 
-static char *vduse_devnode(struct device *dev, umode_t *mode)
+static char *vduse_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "vduse/%s", dev_name(dev));
 }
index 6e8804fe00953d4fa7beaf1b503751302cefcafc..5bf4b34549189b012094a350b6ebc051b420d020 100644 (file)
@@ -1812,7 +1812,7 @@ EXPORT_SYMBOL(vfio_set_irqs_validate_and_prepare);
 /*
  * Module/class support
  */
-static char *vfio_devnode(struct device *dev, umode_t *mode)
+static char *vfio_devnode(const struct device *dev, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev));
 }
index d8542ec2f38c6e4d1065f6d4bdef5eb23565fd37..b31c9c72d90b4b639207fba3b24c6e977fe42aec 100644 (file)
@@ -46,7 +46,7 @@ static int pmsg_major;
 #undef pr_fmt
 #define pr_fmt(fmt) PMSG_NAME ": " fmt
 
-static char *pmsg_devnode(struct device *dev, umode_t *mode)
+static char *pmsg_devnode(const struct device *dev, umode_t *mode)
 {
        if (mode)
                *mode = 0220;
index 94b1107258e50ddd1d6adaf63f91e435a4207bb9..42cc3fb44a8463e4fe74759315439f233c344175 100644 (file)
@@ -60,7 +60,7 @@ struct class {
        struct kobject                  *dev_kobj;
 
        int (*dev_uevent)(const struct device *dev, struct kobj_uevent_env *env);
-       char *(*devnode)(struct device *dev, umode_t *mode);
+       char *(*devnode)(const struct device *dev, umode_t *mode);
 
        void (*class_release)(struct class *class);
        void (*dev_release)(struct device *dev);
index 3332fe321737eccc262c7622f744fac11cc700eb..3e7dd6fcb7cf9d205211ba29dd87f72dcd98a329 100644 (file)
@@ -30,7 +30,7 @@ MODULE_DESCRIPTION("Core sound module");
 MODULE_AUTHOR("Alan Cox");
 MODULE_LICENSE("GPL");
 
-static char *sound_devnode(struct device *dev, umode_t *mode)
+static char *sound_devnode(const struct device *dev, umode_t *mode)
 {
        if (MAJOR(dev->devt) == SOUND_MAJOR)
                return NULL;
This page took 0.160688 seconds and 4 git commands to generate.