mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 23:04:54 +01:00
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]>
This commit is contained in:
1 parent
23680f0b7d
commit
ff62b8e658
24 files changed
+29
-29
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user