Skip to content

Commit d51c9cd

Browse files
Christoph Hellwigaxboe
Christoph Hellwig
authored andcommitted
block: return void from the queue_sysfs_entry load_module method
Requesting a module either succeeds or does nothing, return an error from this method does not make sense. Also move the load_module after the store method in the struct declaration to keep the important show and store methods together. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 758737d commit d51c9cd

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

block/blk-sysfs.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
struct queue_sysfs_entry {
2424
struct attribute attr;
2525
ssize_t (*show)(struct gendisk *disk, char *page);
26-
int (*load_module)(struct gendisk *disk, const char *page, size_t count);
2726
ssize_t (*store)(struct gendisk *disk, const char *page, size_t count);
27+
void (*load_module)(struct gendisk *disk, const char *page, size_t count);
2828
};
2929

3030
static ssize_t
@@ -684,11 +684,8 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr,
684684
* queue to ensure that the module file can be read when the request
685685
* queue is the one for the device storing the module file.
686686
*/
687-
if (entry->load_module) {
688-
res = entry->load_module(disk, page, length);
689-
if (res)
690-
return res;
691-
}
687+
if (entry->load_module)
688+
entry->load_module(disk, page, length);
692689

693690
blk_mq_freeze_queue(q);
694691
mutex_lock(&q->sysfs_lock);

block/elevator.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,15 +704,15 @@ static int elevator_change(struct request_queue *q, const char *elevator_name)
704704
return ret;
705705
}
706706

707-
int elv_iosched_load_module(struct gendisk *disk, const char *buf,
708-
size_t count)
707+
void elv_iosched_load_module(struct gendisk *disk, const char *buf,
708+
size_t count)
709709
{
710710
char elevator_name[ELV_NAME_MAX];
711711
struct elevator_type *found;
712712
const char *name;
713713

714714
if (!elv_support_iosched(disk->queue))
715-
return -EOPNOTSUPP;
715+
return;
716716

717717
strscpy(elevator_name, buf, sizeof(elevator_name));
718718
name = strstrip(elevator_name);
@@ -723,8 +723,6 @@ int elv_iosched_load_module(struct gendisk *disk, const char *buf,
723723

724724
if (!found)
725725
request_module("%s-iosched", name);
726-
727-
return 0;
728726
}
729727

730728
ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,

block/elevator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ extern void elv_unregister(struct elevator_type *);
148148
* io scheduler sysfs switching
149149
*/
150150
ssize_t elv_iosched_show(struct gendisk *disk, char *page);
151-
int elv_iosched_load_module(struct gendisk *disk, const char *page,
152-
size_t count);
151+
void elv_iosched_load_module(struct gendisk *disk, const char *page,
152+
size_t count);
153153
ssize_t elv_iosched_store(struct gendisk *disk, const char *page, size_t count);
154154

155155
extern bool elv_bio_merge_ok(struct request *, struct bio *);

0 commit comments

Comments
 (0)