diff mbox series

block: return void from the queue_sysfs_entry load_module method

Message ID 20241008050841.104602-1-hch@lst.de (mailing list archive)
State New
Headers show
Series block: return void from the queue_sysfs_entry load_module method | expand

Commit Message

Christoph Hellwig Oct. 8, 2024, 5:08 a.m. UTC
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 <hch@lst.de>
---
 block/blk-sysfs.c | 9 +++------
 block/elevator.c  | 7 ++-----
 block/elevator.h  | 4 ++--
 3 files changed, 7 insertions(+), 13 deletions(-)

Comments

Damien Le Moal Oct. 8, 2024, 5:15 a.m. UTC | #1
On 10/8/24 14:08, Christoph Hellwig wrote:
> 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 <hch@lst.de>

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Andreas Hindborg Oct. 8, 2024, 8:36 a.m. UTC | #2
Christoph Hellwig <hch@lst.de> writes:

> 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 <hch@lst.de>
> ---

Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Jens Axboe Oct. 8, 2024, 1:28 p.m. UTC | #3
On Tue, 08 Oct 2024 07:08:41 +0200, Christoph Hellwig wrote:
> 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.
> 
> 
> [...]

Applied, thanks!

[1/1] block: return void from the queue_sysfs_entry load_module method
      commit: a2c17a5ea44f603eb4fbbdc13bdbcec587060635

Best regards,
diff mbox series

Patch

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index e85941bec857b6..8717d43e0792b0 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -23,8 +23,8 @@ 
 struct queue_sysfs_entry {
 	struct attribute attr;
 	ssize_t (*show)(struct gendisk *disk, char *page);
-	int (*load_module)(struct gendisk *disk, const char *page, size_t count);
 	ssize_t (*store)(struct gendisk *disk, const char *page, size_t count);
+	void (*load_module)(struct gendisk *disk, const char *page, size_t count);
 };
 
 static ssize_t
@@ -684,11 +684,8 @@  queue_attr_store(struct kobject *kobj, struct attribute *attr,
 	 * queue to ensure that the module file can be read when the request
 	 * queue is the one for the device storing the module file.
 	 */
-	if (entry->load_module) {
-		res = entry->load_module(disk, page, length);
-		if (res)
-			return res;
-	}
+	if (entry->load_module)
+		entry->load_module(disk, page, length);
 
 	blk_mq_freeze_queue(q);
 	mutex_lock(&q->sysfs_lock);
diff --git a/block/elevator.c b/block/elevator.c
index 4122026b11f1a1..d6b4eb5443d97f 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -705,19 +705,16 @@  static int elevator_change(struct request_queue *q, const char *elevator_name)
 	return ret;
 }
 
-int elv_iosched_load_module(struct gendisk *disk, const char *buf,
+void elv_iosched_load_module(struct gendisk *disk, const char *buf,
 			    size_t count)
 {
 	char elevator_name[ELV_NAME_MAX];
 
 	if (!elv_support_iosched(disk->queue))
-		return -EOPNOTSUPP;
+		return;
 
 	strscpy(elevator_name, buf, sizeof(elevator_name));
-
 	request_module("%s-iosched", strstrip(elevator_name));
-
-	return 0;
 }
 
 ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,
diff --git a/block/elevator.h b/block/elevator.h
index 2a78544bf20180..dbf357ef4fab93 100644
--- a/block/elevator.h
+++ b/block/elevator.h
@@ -148,8 +148,8 @@  extern void elv_unregister(struct elevator_type *);
  * io scheduler sysfs switching
  */
 ssize_t elv_iosched_show(struct gendisk *disk, char *page);
-int elv_iosched_load_module(struct gendisk *disk, const char *page,
-			    size_t count);
+void elv_iosched_load_module(struct gendisk *disk, const char *page,
+		size_t count);
 ssize_t elv_iosched_store(struct gendisk *disk, const char *page, size_t count);
 
 extern bool elv_bio_merge_ok(struct request *, struct bio *);