All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: saeed.bishara@gmail.com
Cc: linux-ide@vger.kernel.org, Saeed Bishara <saeed@marvell.com>
Subject: Re: [PATCH 1/2] [libata] sata_mv: Remove PCI dependency
Date: Tue, 18 Dec 2007 16:57:24 -0500	[thread overview]
Message-ID: <47684244.6000307@garzik.org> (raw)
In-Reply-To: <1196610199229-git-send-email-saeed.bishara@gmail.com>

saeed.bishara@gmail.com wrote:
> From: Saeed Bishara <saeed@marvell.com>
> 
> The integrated SATA controller is connected directly to the SoC's
> internal bus, not via PCI interface. this patch removes the dependency
> on the PCI interface.
> 
> Signed-off-by: Saeed Bishara <saeed@marvell.com>
> ---
>  drivers/ata/Kconfig   |    2 +-
>  drivers/ata/sata_mv.c |  113 ++++++++++++++++++++++++++++++-------------------
>  2 files changed, 71 insertions(+), 44 deletions(-)


Overall, a good patch, though some minor revisions are needed (comments 
inline).



> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index ba63619..c60842b 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -69,7 +69,7 @@ config ATA_PIIX
>  
>  config SATA_MV
>  	tristate "Marvell SATA support (HIGHLY EXPERIMENTAL)"
> -	depends on PCI && EXPERIMENTAL
> +	depends on EXPERIMENTAL
>  	help
>  	  This option enables support for the Marvell Serial ATA family.
>  	  Currently supports 88SX[56]0[48][01] chips.
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index 97c3e11..cbd3f1b 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -421,7 +421,9 @@ static void mv_error_handler(struct ata_port *ap);
>  static void mv_post_int_cmd(struct ata_queued_cmd *qc);
>  static void mv_eh_freeze(struct ata_port *ap);
>  static void mv_eh_thaw(struct ata_port *ap);
> +#ifdef CONFIG_PCI
>  static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
> +#endif

with the proper ordering (see comments below), you can remove this 
prototype altogether


>  static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
>  			   unsigned int port);
> @@ -638,14 +640,14 @@ static const struct pci_device_id mv_pci_tbl[] = {
>  
>  	{ }			/* terminate list */
>  };
> -
> +#ifdef CONFIG_PCI
>  static struct pci_driver mv_pci_driver = {
>  	.name			= DRV_NAME,
>  	.id_table		= mv_pci_tbl,
>  	.probe			= mv_init_one,
>  	.remove			= ata_pci_remove_one,
>  };
> -
> +#endif

I would prefer that you move this, and the pci_device_id table, down to 
the bottom of the file with the rest of the #CONFIG_PCI section of code 
that you have nicely arranged.


> @@ -2616,6 +2581,47 @@ done:
>  	return rc;
>  }
>  
> +#ifdef CONFIG_PCI
> +
> +/*
> + * module options
> + */
> +static int msi;	      /* Use PCI msi; either zero (off, default) or non-zero */
> +
> +
> +/* move to PCI layer or libata core? */
> +static int pci_go_64(struct pci_dev *pdev)
> +{
> +	int rc;
> +
> +	if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
> +		rc = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
> +		if (rc) {
> +			rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
> +			if (rc) {
> +				dev_printk(KERN_ERR, &pdev->dev,
> +					   "64-bit DMA enable failed\n");
> +				return rc;
> +			}
> +		}
> +	} else {
> +		rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
> +		if (rc) {
> +			dev_printk(KERN_ERR, &pdev->dev,
> +				   "32-bit DMA enable failed\n");
> +			return rc;
> +		}
> +		rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
> +		if (rc) {
> +			dev_printk(KERN_ERR, &pdev->dev,
> +				   "32-bit consistent DMA enable failed\n");
> +			return rc;
> +		}
> +	}
> +
> +	return rc;
> +}
> +
>  /**
>   *      mv_print_info - Dump key info to kernel log for perusal.
>   *      @host: ATA host to print info about
> @@ -2721,15 +2727,34 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  				 IS_GEN_I(hpriv) ? &mv5_sht : &mv6_sht);
>  }
>  

nicely done, this [once my comments are taken] arranges everything into 
a single PCI-specific area.


> -static int __init mv_init(void)
> +static int __init mv_pci_register_driver(void)
>  {
>  	return pci_register_driver(&mv_pci_driver);
>  }
>  
> -static void __exit mv_exit(void)
> +static void __exit mv_pci_unregister_driver(void)
>  {
>  	pci_unregister_driver(&mv_pci_driver);
>  }
> +#else
> +static int __init mv_pci_register_driver(void)
> +{
> +	return 0;
> +}
> +
> +static void __exit mv_pci_unregister_driver(void)
> +{
> +}
> +#endif
> +static int __init mv_init(void)
> +{
> +	return mv_pci_register_driver();
> +}
> +
> +static void __exit mv_exit(void)
> +{
> +	mv_pci_unregister_driver();
> +}

The way we do multi-bus drivers that you do something like

static int mv_init(void)
{
	#ifdef CONFIG_PCI
	rc = pci_register_driver(&mv_driver);
	if (rc)
		return rc;
	#endif

	#ifdef MY_MARVELL_SOC_EMBEDDED_CHIP
	rc = my_soc_register_platform_driver(&platform_driver);
	if (rc)
		goto err_out;
	#endif

	return 0;

err_out:
#ifdef CONFIG_PCI
	pci_unregister_driver(&mv_driver);
#endif
	return rc;
}

The module unregister function mv_exit() should do something similar, in 
reverse order.

Even embedded SoC controllers need to register a driver (usually a 
platform_driver with platform_devices).



>  MODULE_AUTHOR("Brett Russ");
>  MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers");
> @@ -2737,8 +2762,10 @@ MODULE_LICENSE("GPL");
>  MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
>  MODULE_VERSION(DRV_VERSION);
>  
> +#ifdef CONFIG_PCI
>  module_param(msi, int, 0444);
>  MODULE_PARM_DESC(msi, "Enable use of PCI MSI (0=off, 1=on)");
> +#endif

agreed -- in contrast with my comments above, please keep this module 
option right where it is, and add the #ifdef CONFIG_PCI precisely as you 
have done.  do /not/ move it into the CONFIG_PCI section referred to in 
my other comments.

	Jeff





  parent reply	other threads:[~2007-12-18 21:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-02 15:43 [PATCH 0/2] [libata] sata_mv: Add support for Marvell's integrated SATA controller saeed.bishara
2007-12-02 15:43 ` [PATCH 1/2] [libata] sata_mv: Remove PCI dependency saeed.bishara
2007-12-02 15:43   ` [PATCH 2/2] [libata] sata_mv: Support integrated controllers saeed.bishara
2007-12-18 22:02     ` Jeff Garzik
2007-12-18 21:57   ` Jeff Garzik [this message]
2007-12-18 21:58   ` [PATCH 1/2] [libata] sata_mv: Remove PCI dependency Jeff Garzik
2007-12-25 16:42     ` saeed bishara
2008-01-09 11:59       ` saeed bishara
2008-01-10  4:35         ` Jeff Garzik
2008-01-16 10:01       ` Jeff Garzik
2008-01-16 16:17         ` saeed bishara
2008-01-16 19:01           ` Mark Lord
2008-01-17 14:24             ` saeed bishara
2008-01-29 17:12               ` Jeff Garzik
2008-01-29 17:17                 ` saeed bishara
2008-01-21  7:31         ` Tejun Heo
2008-01-23  4:04           ` Jeff Garzik
2008-01-23  4:15             ` Tejun Heo
2008-01-29  8:51             ` saeed bishara
2008-01-29 16:20               ` Mark Lord
2008-01-29 16:28                 ` Jeff Garzik
2008-01-29 16:26               ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2007-12-02 15:26 [PATCH 0/2] [libata] sata_mv: Add support for Marvell's integrated SATA controller saeed.bishara
2007-12-02 15:26 ` [PATCH 1/2] [libata] sata_mv: Remove PCI dependency saeed.bishara
2007-12-04  9:07   ` saeed bishara
2007-12-05 12:11   ` saeed bishara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47684244.6000307@garzik.org \
    --to=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=saeed.bishara@gmail.com \
    --cc=saeed@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.