Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit ff62b8e

Browse files
committed
driver core: make struct class.devnode() take a const *
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 <fenghua.yu@intel.com> Cc: Reinette Chatre <reinette.chatre@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: x86@kernel.org Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Jens Axboe <axboe@kernel.dk> Cc: Justin Sanders <justin@coraid.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Benjamin Gaignard <benjamin.gaignard@collabora.com> Cc: Liam Mark <lmark@codeaurora.org> Cc: Laura Abbott <labbott@redhat.com> Cc: Brian Starkey <Brian.Starkey@arm.com> Cc: John Stultz <jstultz@google.com> Cc: "Christian König" <christian.koenig@amd.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@gmail.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Leon Romanovsky <leon@kernel.org> Cc: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Sean Young <sean@mess.org> Cc: Frank Haverkamp <haver@linux.ibm.com> Cc: Jiri Slaby <jirislaby@kernel.org> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Alex Williamson <alex.williamson@redhat.com> Cc: Cornelia Huck <cohuck@redhat.com> Cc: Kees Cook <keescook@chromium.org> Cc: Anton Vorontsov <anton@enomsg.org> Cc: Colin Cross <ccross@android.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Cc: Xie Yongji <xieyongji@bytedance.com> Cc: Gautam Dawar <gautam.dawar@xilinx.com> Cc: Dan Carpenter <error27@gmail.com> Cc: Eli Cohen <elic@nvidia.com> Cc: Parav Pandit <parav@nvidia.com> Cc: Maxime Coquelin <maxime.coquelin@redhat.com> Cc: alsa-devel@alsa-project.org Cc: dri-devel@lists.freedesktop.org Cc: kvm@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Cc: linux-block@vger.kernel.org Cc: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-media@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: virtualization@lists.linux-foundation.org Link: https://lore.kernel.org/r/20221123122523.1332370-2-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 23680f0 commit ff62b8e

File tree

24 files changed

+29
-29
lines changed

24 files changed

+29
-29
lines changed

arch/x86/kernel/cpu/resctrl/pseudo_lock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,9 +1560,9 @@ static const struct file_operations pseudo_lock_dev_fops = {
15601560
.mmap = pseudo_lock_dev_mmap,
15611561
};
15621562

1563-
static char *pseudo_lock_devnode(struct device *dev, umode_t *mode)
1563+
static char *pseudo_lock_devnode(const struct device *dev, umode_t *mode)
15641564
{
1565-
struct rdtgroup *rdtgrp;
1565+
const struct rdtgroup *rdtgrp;
15661566

15671567
rdtgrp = dev_get_drvdata(dev);
15681568
if (mode)

arch/x86/kernel/cpuid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static int cpuid_device_destroy(unsigned int cpu)
139139
return 0;
140140
}
141141

142-
static char *cpuid_devnode(struct device *dev, umode_t *mode)
142+
static char *cpuid_devnode(const struct device *dev, umode_t *mode)
143143
{
144144
return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt));
145145
}

arch/x86/kernel/msr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int msr_device_destroy(unsigned int cpu)
250250
return 0;
251251
}
252252

253-
static char *msr_devnode(struct device *dev, umode_t *mode)
253+
static char *msr_devnode(const struct device *dev, umode_t *mode)
254254
{
255255
return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
256256
}

block/bsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ struct bsg_device *bsg_register_queue(struct request_queue *q,
232232
}
233233
EXPORT_SYMBOL_GPL(bsg_register_queue);
234234

235-
static char *bsg_devnode(struct device *dev, umode_t *mode)
235+
static char *bsg_devnode(const struct device *dev, umode_t *mode)
236236
{
237237
return kasprintf(GFP_KERNEL, "bsg/%s", dev_name(dev));
238238
}

drivers/block/aoe/aoechr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static const struct file_operations aoe_fops = {
273273
.llseek = noop_llseek,
274274
};
275275

276-
static char *aoe_devnode(struct device *dev, umode_t *mode)
276+
static char *aoe_devnode(const struct device *dev, umode_t *mode)
277277
{
278278
return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev));
279279
}

drivers/char/mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ static const struct file_operations memory_fops = {
746746
.llseek = noop_llseek,
747747
};
748748

749-
static char *mem_devnode(struct device *dev, umode_t *mode)
749+
static char *mem_devnode(const struct device *dev, umode_t *mode)
750750
{
751751
if (mode && devlist[MINOR(dev->devt)].mode)
752752
*mode = devlist[MINOR(dev->devt)].mode;

drivers/char/misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ void misc_deregister(struct miscdevice *misc)
254254
}
255255
EXPORT_SYMBOL(misc_deregister);
256256

257-
static char *misc_devnode(struct device *dev, umode_t *mode)
257+
static char *misc_devnode(const struct device *dev, umode_t *mode)
258258
{
259-
struct miscdevice *c = dev_get_drvdata(dev);
259+
const struct miscdevice *c = dev_get_drvdata(dev);
260260

261261
if (mode && c->mode)
262262
*mode = c->mode;

drivers/dma-buf/dma-heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info)
299299
return err_ret;
300300
}
301301

302-
static char *dma_heap_devnode(struct device *dev, umode_t *mode)
302+
static char *dma_heap_devnode(const struct device *dev, umode_t *mode)
303303
{
304304
return kasprintf(GFP_KERNEL, "dma_heap/%s", dev_name(dev));
305305
}

drivers/gpu/drm/drm_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void drm_sysfs_acpi_register(void) { }
9090
static void drm_sysfs_acpi_unregister(void) { }
9191
#endif
9292

93-
static char *drm_devnode(struct device *dev, umode_t *mode)
93+
static char *drm_devnode(const struct device *dev, umode_t *mode)
9494
{
9595
return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
9696
}

drivers/infiniband/core/user_mad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ static struct attribute *umad_class_dev_attrs[] = {
12241224
};
12251225
ATTRIBUTE_GROUPS(umad_class_dev);
12261226

1227-
static char *umad_devnode(struct device *dev, umode_t *mode)
1227+
static char *umad_devnode(const struct device *dev, umode_t *mode)
12281228
{
12291229
return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
12301230
}

0 commit comments

Comments
 (0)