ata: pata_parport: make pata_parport_bus_type const

Message ID 20240204-bus_cleanup-ata-v1-1-2bdc1fadf356@marliere.net
State New
Headers
Series ata: pata_parport: make pata_parport_bus_type const |

Commit Message

Ricardo B. Marliere Feb. 4, 2024, 3:23 p.m. UTC
  Now that the driver core can properly handle constant struct bus_type,
move the pata_parport_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

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/ata/pata_parport/pata_parport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: c8474c7273ac3bad718c33118aa82efb7b374f6e
change-id: 20240204-bus_cleanup-ata-bd1625fdab09

Best regards,
  

Comments

Damien Le Moal Feb. 4, 2024, 11:32 p.m. UTC | #1
On 2/5/24 00:23, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the pata_parport_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
  
Greg KH Feb. 5, 2024, 12:51 p.m. UTC | #2
On Sun, Feb 04, 2024 at 12:23:29PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the pata_parport_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  
Niklas Cassel Feb. 6, 2024, 9:58 a.m. UTC | #3
On Sun, Feb 04, 2024 at 12:23:29PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the pata_parport_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> 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/ata/pata_parport/pata_parport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c
> index a7adfdcb5e27..9a2cb9ca9d1d 100644
> --- a/drivers/ata/pata_parport/pata_parport.c
> +++ b/drivers/ata/pata_parport/pata_parport.c
> @@ -464,7 +464,7 @@ static void pata_parport_bus_release(struct device *dev)
>  	/* nothing to do here but required to avoid warning on device removal */
>  }
>  
> -static struct bus_type pata_parport_bus_type = {
> +static const struct bus_type pata_parport_bus_type = {
>  	.name = DRV_NAME,
>  };
>  
> 
> ---
> base-commit: c8474c7273ac3bad718c33118aa82efb7b374f6e
> change-id: 20240204-bus_cleanup-ata-bd1625fdab09
> 
> Best regards,
> -- 
> Ricardo B. Marliere <ricardo@marliere.net>
> 

Applied:
https://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git/log/?h=for-6.9
  

Patch

diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_parport/pata_parport.c
index a7adfdcb5e27..9a2cb9ca9d1d 100644
--- a/drivers/ata/pata_parport/pata_parport.c
+++ b/drivers/ata/pata_parport/pata_parport.c
@@ -464,7 +464,7 @@  static void pata_parport_bus_release(struct device *dev)
 	/* nothing to do here but required to avoid warning on device removal */
 }
 
-static struct bus_type pata_parport_bus_type = {
+static const struct bus_type pata_parport_bus_type = {
 	.name = DRV_NAME,
 };