Skip to content

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 <[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]>
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)