drivers/scsi/scsi_priv.h | 6 +++--- drivers/scsi/scsi_sysfs.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
Now that the driver core can properly handle constant struct bus_type,
move the scsi_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
Remove some extraneous whitespace.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
drivers/scsi/scsi_priv.h | 6 +++---
drivers/scsi/scsi_sysfs.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 1fbfe1b52c9f..6a02114776b3 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -54,7 +54,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd);
void scsi_log_send(struct scsi_cmnd *cmd);
void scsi_log_completion(struct scsi_cmnd *cmd, int disposition);
#else
-static inline void scsi_log_send(struct scsi_cmnd *cmd)
+static inline void scsi_log_send(struct scsi_cmnd *cmd)
{ };
static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
{ };
@@ -156,7 +156,7 @@ extern void scsi_sysfs_device_initialize(struct scsi_device *);
extern struct scsi_transport_template blank_transport_template;
extern void __scsi_remove_device(struct scsi_device *);
-extern struct bus_type scsi_bus_type;
+extern const struct bus_type scsi_bus_type;
extern const struct attribute_group *scsi_shost_groups[];
/* scsi_netlink.c */
@@ -197,7 +197,7 @@ struct bsg_device *scsi_bsg_register_queue(struct scsi_device *sdev);
extern int scsi_device_max_queue_depth(struct scsi_device *sdev);
-/*
+/*
* internal scsi timeout functions: for use by mid-layer and transport
* classes.
*/
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 24f6eefb6803..7f1fede8ef5d 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -549,7 +549,7 @@ static int scsi_bus_uevent(const struct device *dev, struct kobj_uevent_env *env
return 0;
}
-struct bus_type scsi_bus_type = {
+const struct bus_type scsi_bus_type = {
.name = "scsi",
.match = scsi_bus_match,
.uevent = scsi_bus_uevent,
@@ -656,7 +656,7 @@ static int scsi_sdev_check_buf_bit(const char *buf)
return 1;
else if (buf[0] == '0')
return 0;
- else
+ else
return -EINVAL;
} else
return -EINVAL;
@@ -881,7 +881,7 @@ store_queue_type_field(struct device *dev, struct device_attribute *attr,
if (!sdev->tagged_supported)
return -EINVAL;
-
+
sdev_printk(KERN_INFO, sdev,
"ignoring write to deprecated queue_type attribute");
return count;
---
base-commit: 59828c7b5975f442ad5bb74a031fe388341f323e
change-id: 20240211-bus_cleanup-scsi2-16c3cfba91af
Best regards,
--
Ricardo B. Marliere <ricardo@marliere.net>
On Sun, Feb 11, 2024 at 12:33:50PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the scsi_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
>
> Remove some extraneous whitespace.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
> drivers/scsi/scsi_priv.h | 6 +++---
> drivers/scsi/scsi_sysfs.c | 6 +++---
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
> index 1fbfe1b52c9f..6a02114776b3 100644
> --- a/drivers/scsi/scsi_priv.h
> +++ b/drivers/scsi/scsi_priv.h
> @@ -54,7 +54,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd);
> void scsi_log_send(struct scsi_cmnd *cmd);
> void scsi_log_completion(struct scsi_cmnd *cmd, int disposition);
> #else
> -static inline void scsi_log_send(struct scsi_cmnd *cmd)
> +static inline void scsi_log_send(struct scsi_cmnd *cmd)
Why is this line changed?
> { };
> static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
> { };
> @@ -156,7 +156,7 @@ extern void scsi_sysfs_device_initialize(struct scsi_device *);
> extern struct scsi_transport_template blank_transport_template;
> extern void __scsi_remove_device(struct scsi_device *);
>
> -extern struct bus_type scsi_bus_type;
> +extern const struct bus_type scsi_bus_type;
> extern const struct attribute_group *scsi_shost_groups[];
>
> /* scsi_netlink.c */
> @@ -197,7 +197,7 @@ struct bsg_device *scsi_bsg_register_queue(struct scsi_device *sdev);
>
> extern int scsi_device_max_queue_depth(struct scsi_device *sdev);
>
> -/*
> +/*
And this?
> * internal scsi timeout functions: for use by mid-layer and transport
> * classes.
> */
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index 24f6eefb6803..7f1fede8ef5d 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -549,7 +549,7 @@ static int scsi_bus_uevent(const struct device *dev, struct kobj_uevent_env *env
> return 0;
> }
>
> -struct bus_type scsi_bus_type = {
> +const struct bus_type scsi_bus_type = {
> .name = "scsi",
> .match = scsi_bus_match,
> .uevent = scsi_bus_uevent,
> @@ -656,7 +656,7 @@ static int scsi_sdev_check_buf_bit(const char *buf)
> return 1;
> else if (buf[0] == '0')
> return 0;
> - else
> + else
And this, please be more careful, it looks like your editor stripped out
all trailing whitespace, which is fine for new files, but not for
existing ones.
thanks,
greg k-h
Hi Greg,
On 12 Feb 11:45, Greg Kroah-Hartman wrote:
> On Sun, Feb 11, 2024 at 12:33:50PM -0300, Ricardo B. Marliere wrote:
> > Now that the driver core can properly handle constant struct bus_type,
> > move the scsi_bus_type variable to be a constant structure as well,
> > placing it into read-only memory which can not be modified at runtime.
> >
> > Remove some extraneous whitespace.
I saw some patches did this, thought it would ok to add.
> >
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> > ---
> > drivers/scsi/scsi_priv.h | 6 +++---
> > drivers/scsi/scsi_sysfs.c | 6 +++---
> > 2 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
> > index 1fbfe1b52c9f..6a02114776b3 100644
> > --- a/drivers/scsi/scsi_priv.h
> > +++ b/drivers/scsi/scsi_priv.h
> > @@ -54,7 +54,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd);
> > void scsi_log_send(struct scsi_cmnd *cmd);
> > void scsi_log_completion(struct scsi_cmnd *cmd, int disposition);
> > #else
> > -static inline void scsi_log_send(struct scsi_cmnd *cmd)
> > +static inline void scsi_log_send(struct scsi_cmnd *cmd)
>
> Why is this line changed?
>
> > { };
> > static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
> > { };
> > @@ -156,7 +156,7 @@ extern void scsi_sysfs_device_initialize(struct scsi_device *);
> > extern struct scsi_transport_template blank_transport_template;
> > extern void __scsi_remove_device(struct scsi_device *);
> >
> > -extern struct bus_type scsi_bus_type;
> > +extern const struct bus_type scsi_bus_type;
> > extern const struct attribute_group *scsi_shost_groups[];
> >
> > /* scsi_netlink.c */
> > @@ -197,7 +197,7 @@ struct bsg_device *scsi_bsg_register_queue(struct scsi_device *sdev);
> >
> > extern int scsi_device_max_queue_depth(struct scsi_device *sdev);
> >
> > -/*
> > +/*
>
> And this?
>
>
> > * internal scsi timeout functions: for use by mid-layer and transport
> > * classes.
> > */
> > diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> > index 24f6eefb6803..7f1fede8ef5d 100644
> > --- a/drivers/scsi/scsi_sysfs.c
> > +++ b/drivers/scsi/scsi_sysfs.c
> > @@ -549,7 +549,7 @@ static int scsi_bus_uevent(const struct device *dev, struct kobj_uevent_env *env
> > return 0;
> > }
> >
> > -struct bus_type scsi_bus_type = {
> > +const struct bus_type scsi_bus_type = {
> > .name = "scsi",
> > .match = scsi_bus_match,
> > .uevent = scsi_bus_uevent,
> > @@ -656,7 +656,7 @@ static int scsi_sdev_check_buf_bit(const char *buf)
> > return 1;
> > else if (buf[0] == '0')
> > return 0;
> > - else
> > + else
>
> And this, please be more careful, it looks like your editor stripped out
> all trailing whitespace, which is fine for new files, but not for
> existing ones.
In fact it took me a while to figure this out, as I don't have
format-on-save enabled. It's actually due to the recently added
.editorconfig file to the tree. I can send it without the whitespace
changes if that's better, but it's there in the changelog. Please let me
know.
Thanks for reviewing,
- Ricardo.
>
> thanks,
>
> greg k-h
On 2/12/24 03:30, Ricardo B. Marliere wrote: >>> Remove some extraneous whitespace. > > I saw some patches did this, thought it would ok to add. Please don't do that. Each patch should only make a single logical change. Additionally, making unnecessary whitespace changes is controversial because it makes reviewing and backporting patches harder than necessary. Bart.
Hi Bart, On 12 Feb 09:42, Bart Van Assche wrote: > On 2/12/24 03:30, Ricardo B. Marliere wrote: > >>> Remove some extraneous whitespace. > > > > I saw some patches did this, thought it would ok to add. > > Please don't do that. Each patch should only make a single logical change. > Additionally, making unnecessary whitespace changes is controversial because > it makes reviewing and backporting patches harder than necessary. Ack. Will send a v2. Thanks, - Ricardo. > > Bart.
© 2016 - 2026 Red Hat, Inc.