Patchwork [1/1] UBUNTU: SAUCE: ata_piix: add a disable_driver option

login
register
mail settings
Submitter Andy Whitcroft
Date May 17, 2012, 5:55 p.m.
Message ID <1337277328-10590-2-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/160001/
State New
Headers show

Comments

Andy Whitcroft - May 17, 2012, 5:55 p.m.
We need to be able to fully disable the ata_piix driver from the kernel
command line.  Add a generic disable_driver to the module init to
completely short circuit the initialisation.

BugLink: http://bugs.launchpad.net/bugs/994870
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 drivers/ata/ata_piix.c |    7 +++++++
 1 file changed, 7 insertions(+)
Luis Henriques - May 17, 2012, 6:16 p.m.
Andy Whitcroft <apw@canonical.com> writes:

> We need to be able to fully disable the ata_piix driver from the kernel
> command line.  Add a generic disable_driver to the module init to
> completely short circuit the initialisation.
>
> BugLink: http://bugs.launchpad.net/bugs/994870
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  drivers/ata/ata_piix.c |    7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> index 1952869..0d2cf7e 100644
> --- a/drivers/ata/ata_piix.c
> +++ b/drivers/ata/ata_piix.c
> @@ -1708,10 +1708,16 @@ static void piix_remove_one(struct pci_dev *pdev)
>  	ata_pci_remove_one(pdev);
>  }
>  
> +static bool disable_driver = 0;
>  static int __init piix_init(void)
>  {
>  	int rc;
>  
> +	if (disable_driver) {
> +		printk(KERN_WARNING "ata_piix: driver disabled completely\n");

The only comment I have would be that you could replace printk by
one of the dev_* functions, to be consistent with the code in the
file.  Other than that, it looks fine to me.

--
Luis

> + return 0; + } + DPRINTK("pci_register_driver\n"); rc =
> pci_register_driver(&piix_pci_driver); if (rc) @@ -1732,3 +1738,4 @@
> module_init(piix_init); module_exit(piix_exit);
>  
>  module_param(prefer_ms_hyperv, int, 0);
> +module_param(disable_driver, bool, 0);
> -- 
> 1.7.9.5

Patch

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 1952869..0d2cf7e 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1708,10 +1708,16 @@  static void piix_remove_one(struct pci_dev *pdev)
 	ata_pci_remove_one(pdev);
 }
 
+static bool disable_driver = 0;
 static int __init piix_init(void)
 {
 	int rc;
 
+	if (disable_driver) {
+		printk(KERN_WARNING "ata_piix: driver disabled completely\n");
+		return 0;
+	}
+
 	DPRINTK("pci_register_driver\n");
 	rc = pci_register_driver(&piix_pci_driver);
 	if (rc)
@@ -1732,3 +1738,4 @@  module_init(piix_init);
 module_exit(piix_exit);
 
 module_param(prefer_ms_hyperv, int, 0);
+module_param(disable_driver, bool, 0);