From: Tejun Heo <htejun@gmail.com>
To: jeff@garzik.org, linux-ide@vger.kernel.org, liml@rtr.ca,
alan@lxorguk.ukuu.org.uk, kngregertsen@norway.atmel.com,
sonic.adi@gmail.com, rmk@dyn-67.arm.linux.org.uk,
alessandro.zummo@to
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 8/9] libata: kill port_info->sht and ->irq_handler
Date: Wed, 30 Jan 2008 18:29:02 +0900 [thread overview]
Message-ID: <12016853441736-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <12016853433196-git-send-email-htejun@gmail.com>
libata core layer doesn't care about sht or ->irq_handler. Those are
only of interest to the LLD during initialization. This is confusing
and has caused several drivers to have duplicate unused initializers
for these fields.
Currently only sata_nv uses these fields. Make sata_nv use
->private_data, which is supposed to carry LLD-specific information,
instead and kill ->sht and ->irq_handler. nv_pi_priv structure is
defined and struct literals are used to initialize private_data.
Notational overhead is negligible.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/ata/sata_nv.c | 29 +++++++++++++++++------------
include/linux/libata.h | 2 --
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 434aee5..065b43f 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -465,58 +465,61 @@ static struct ata_port_operations nv_swncq_ops = {
.port_start = nv_swncq_port_start,
};
+struct nv_pi_priv {
+ irq_handler_t irq_handler;
+ struct scsi_host_template *sht;
+};
+
+#define NV_PI_PRIV(_irq_handler, _sht) \
+ &(struct nv_pi_priv){ .irq_handler = _irq_handler, .sht = _sht }
+
static const struct ata_port_info nv_port_info[] = {
/* generic */
{
- .sht = &nv_sht,
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
.udma_mask = NV_UDMA_MASK,
.port_ops = &nv_generic_ops,
- .irq_handler = nv_generic_interrupt,
+ .private_data = NV_PI_PRIV(nv_generic_interrupt, &nv_sht),
},
/* nforce2/3 */
{
- .sht = &nv_sht,
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
.udma_mask = NV_UDMA_MASK,
.port_ops = &nv_nf2_ops,
- .irq_handler = nv_nf2_interrupt,
+ .private_data = NV_PI_PRIV(nv_nf2_interrupt, &nv_sht),
},
/* ck804 */
{
- .sht = &nv_sht,
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
.udma_mask = NV_UDMA_MASK,
.port_ops = &nv_ck804_ops,
- .irq_handler = nv_ck804_interrupt,
+ .private_data = NV_PI_PRIV(nv_ck804_interrupt, &nv_sht),
},
/* ADMA */
{
- .sht = &nv_adma_sht,
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
ATA_FLAG_MMIO | ATA_FLAG_NCQ,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
.udma_mask = NV_UDMA_MASK,
.port_ops = &nv_adma_ops,
- .irq_handler = nv_adma_interrupt,
+ .private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht),
},
/* SWNCQ */
{
- .sht = &nv_swncq_sht,
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
ATA_FLAG_NCQ,
.pio_mask = NV_PIO_MASK,
.mwdma_mask = NV_MWDMA_MASK,
.udma_mask = NV_UDMA_MASK,
.port_ops = &nv_swncq_ops,
- .irq_handler = nv_swncq_interrupt,
+ .private_data = NV_PI_PRIV(nv_swncq_interrupt, &nv_swncq_sht),
},
};
@@ -2252,6 +2255,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
static int printed_version;
const struct ata_port_info *ppi[] = { NULL, NULL };
+ struct nv_pi_priv *ipriv;
struct ata_host *host;
struct nv_host_priv *hpriv;
int rc;
@@ -2288,6 +2292,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
}
ppi[0] = &nv_port_info[type];
+ ipriv = ppi[0]->private_data;
rc = ata_pci_prepare_sff_host(pdev, ppi, &host);
if (rc)
return rc;
@@ -2332,8 +2337,8 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
nv_swncq_host_init(host);
pci_set_master(pdev);
- return ata_host_activate(host, pdev->irq, ppi[0]->irq_handler,
- IRQF_SHARED, ppi[0]->sht);
+ return ata_host_activate(host, pdev->irq, ipriv->irq_handler,
+ IRQF_SHARED, ipriv->sht);
}
#ifdef CONFIG_PM
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 42d31cd..00991f2 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -756,14 +756,12 @@ struct ata_port_operations {
};
struct ata_port_info {
- struct scsi_host_template *sht;
unsigned long flags;
unsigned long link_flags;
unsigned long pio_mask;
unsigned long mwdma_mask;
unsigned long udma_mask;
struct ata_port_operations *port_ops;
- irq_handler_t irq_handler;
void *private_data;
};
--
1.5.2.4
next prev parent reply other threads:[~2008-01-30 9:29 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-30 9:28 [PATCHSET libata-dev#upstream] clean up scsi_host_templates and ata_port_operations Tejun Heo
2008-01-30 9:28 ` [PATCH 1/9] libata: PCI device should be powered up before being accessed Tejun Heo
2008-02-01 20:44 ` Jeff Garzik
2008-02-11 19:24 ` Jeff Garzik
2008-01-30 9:28 ` [PATCH 2/9] libata: reorganize ata_port_operations Tejun Heo
2008-01-30 9:28 ` [PATCH 3/9] libata: implement and use ata_noop_irq_clear() Tejun Heo
2008-02-01 20:45 ` Jeff Garzik
2008-01-30 9:28 ` [PATCH 4/9] libata: normalize port_info, port_operations and sht tables Tejun Heo
2008-02-01 20:46 ` Jeff Garzik
2008-02-09 1:57 ` Tejun Heo
2008-02-04 14:24 ` Alan Cox
2008-02-09 6:11 ` Tejun Heo
2008-02-09 6:53 ` Tejun Heo
2008-01-30 9:28 ` [PATCH 5/9] libata: implement and use SHT initializers and ops inheritance Tejun Heo
2008-01-30 17:09 ` Mark Lord
2008-01-31 3:39 ` Tejun Heo
2008-01-31 4:04 ` Mark Lord
2008-01-31 4:12 ` Tejun Heo
2008-02-01 20:49 ` Jeff Garzik
2008-02-02 0:06 ` Tejun Heo
2008-01-30 9:29 ` [PATCH 6/9] make ata_pci_init_one() not use ops->irq_handler and pi->sht Tejun Heo
2008-01-30 9:29 ` [PATCH 7/9] libata: stop overloading port_info->private_data Tejun Heo
2008-02-04 14:26 ` Alan Cox
2008-02-09 2:07 ` Tejun Heo
2008-01-30 9:29 ` Tejun Heo [this message]
2008-01-30 9:29 ` [PATCH 9/9] libata: make reset related methods proper port operations Tejun Heo
2008-02-01 20:52 ` Jeff Garzik
2008-01-30 9:49 ` How to verify sht-ops-conversion patch doesn't change anything Tejun Heo
2008-01-30 9:51 ` GIT tree available Tejun Heo
2008-01-31 8:29 ` [PATCHSET libata-dev#upstream] clean up scsi_host_templates and ata_port_operations Akira Iguchi
2008-02-09 1:55 ` Tejun Heo
2008-01-31 8:34 ` Akira Iguchi
-- strict thread matches above, loose matches on Subject: below --
2008-03-11 12:05 [PATCHSET] libata: clean up scsi_host_templates and ata_port_operations, take #3 Tejun Heo
2008-03-11 12:06 ` [PATCH 8/9] libata: kill port_info->sht and ->irq_handler Tejun Heo
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=12016853441736-git-send-email-htejun@gmail.com \
--to=htejun@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=alessandro.zummo@to \
--cc=jeff@garzik.org \
--cc=kngregertsen@norway.atmel.com \
--cc=liml@rtr.ca \
--cc=linux-ide@vger.kernel.org \
--cc=rmk@dyn-67.arm.linux.org.uk \
--cc=sonic.adi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).