blkdev: make struct block_device_operations.devnode() take a const *
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Nov 2022 14:48:43 +0000 (15:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:24:03 +0000 (18:24 +0100)
The devnode() callback in struct block_device_operations 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 the one subsystem that
actually uses this callback.

Acked-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20221109144843.679668-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/pktcdvd.c
include/linux/blkdev.h

index 4cea3b0..8dc15be 100644 (file)
@@ -2632,7 +2632,7 @@ static unsigned int pkt_check_events(struct gendisk *disk,
        return attached_disk->fops->check_events(attached_disk, clearing);
 }
 
-static char *pkt_devnode(struct gendisk *disk, umode_t *mode)
+static char *pkt_devnode(const struct gendisk *disk, umode_t *mode)
 {
        return kasprintf(GFP_KERNEL, "pktcdvd/%s", disk->disk_name);
 }
index 50e358a..2a45579 100644 (file)
@@ -1413,7 +1413,7 @@ struct block_device_operations {
        void (*swap_slot_free_notify) (struct block_device *, unsigned long);
        int (*report_zones)(struct gendisk *, sector_t sector,
                        unsigned int nr_zones, report_zones_cb cb, void *data);
-       char *(*devnode)(struct gendisk *disk, umode_t *mode);
+       char *(*devnode)(const struct gendisk *disk, umode_t *mode);
        /* returns the length of the identifier or a negative errno: */
        int (*get_unique_id)(struct gendisk *disk, u8 id[16],
                        enum blk_unique_id id_type);