From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] ide: add struct ide_port_ops
Date: Tue, 02 Jun 2009 23:42:34 +0400 [thread overview]
Message-ID: <4A2580AA.7090308@ru.mvista.com> (raw)
In-Reply-To: <200802232116.31811.bzolnier@gmail.com>
Bartlomiej Zolnierkiewicz wrote:
> * Move hooks for port/host specific methods from ide_hwif_t to
> 'struct ide_port_ops'.
> * Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info'
> and ide_hwif_t.
> * Update host drivers and core code accordingly.
> While at it:
> * Rename ata66_*() cable detect functions to *_cable_detect() to match
> the standard naming. (Suggested by Sergei Shtylyov)
> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Noticed an issue in pdc202xx_old.c:
> Index: b/drivers/ide/pci/pdc202xx_old.c
> ===================================================================
> --- a/drivers/ide/pci/pdc202xx_old.c
> +++ b/drivers/ide/pci/pdc202xx_old.c
> @@ -115,7 +115,7 @@ static void pdc202xx_set_pio_mode(ide_dr
> pdc202xx_set_mode(drive, XFER_PIO_0 + pio);
> }
>
> -static u8 __devinit pdc2026x_old_cable_detect(ide_hwif_t *hwif)
> +static u8 __devinit pdc2026x_cable_detect(ide_hwif_t *hwif)
> {
> struct pci_dev *dev = to_pci_dev(hwif->dev);
> u16 CIS, mask = hwif->channel ? (1 << 11) : (1 << 10);
> @@ -226,26 +226,6 @@ somebody_else:
> return (dma_stat & 4) == 4; /* return 1 if INTR asserted */
> }
>
> -static void pdc202xx_dma_lost_irq(ide_drive_t *drive)
> -{
> - ide_hwif_t *hwif = HWIF(drive);
> -
> - if (hwif->resetproc != NULL)
> - hwif->resetproc(drive);
> -
> - ide_dma_lost_irq(drive);
> -}
> -
> -static void pdc202xx_dma_timeout(ide_drive_t *drive)
> -{
> - ide_hwif_t *hwif = HWIF(drive);
> -
> - if (hwif->resetproc != NULL)
> - hwif->resetproc(drive);
> -
> - ide_dma_timeout(drive);
> -}
> -
> static void pdc202xx_reset_host (ide_hwif_t *hwif)
> {
> unsigned long high_16 = hwif->extra_base - 16;
> @@ -271,6 +251,18 @@ static void pdc202xx_reset (ide_drive_t
> ide_set_max_pio(drive);
> }
>
> +static void pdc202xx_dma_lost_irq(ide_drive_t *drive)
> +{
> + pdc202xx_reset(drive);
> + ide_dma_lost_irq(drive);
> +}
> +
> +static void pdc202xx_dma_timeout(ide_drive_t *drive)
> +{
> + pdc202xx_reset(drive);
> + ide_dma_timeout(drive);
> +}
> +
Oops, missed this illegetimate change while reviewing: PDC20246 doesn't
have the resetproc() method, hence this switch to direct calling of
pdc202xx_reset() directly was wrong...
> static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev,
> const char *name)
> {
> @@ -281,17 +273,6 @@ static void __devinit init_hwif_pdc202xx
> {
> struct pci_dev *dev = to_pci_dev(hwif->dev);
>
> - hwif->set_pio_mode = &pdc202xx_set_pio_mode;
> - hwif->set_dma_mode = &pdc202xx_set_mode;
> -
> - hwif->quirkproc = &pdc202xx_quirkproc;
> -
> - if (dev->device != PCI_DEVICE_ID_PROMISE_20246) {
> - hwif->resetproc = &pdc202xx_reset;
> -
> - hwif->cable_detect = pdc2026x_old_cable_detect;
> - }
> -
> if (hwif->dma_base == 0)
> return;
>
> @@ -357,6 +338,20 @@ static void __devinit pdc202ata4_fixup_i
> IDE_HFLAG_ABUSE_SET_DMA_MODE | \
> IDE_HFLAG_OFF_BOARD)
>
> +static const struct ide_port_ops pdc20246_port_ops = {
> + .set_pio_mode = pdc202xx_set_pio_mode,
> + .set_dma_mode = pdc202xx_set_mode,
> + .quirkproc = pdc202xx_quirkproc,
> +};
> +
> +static const struct ide_port_ops pdc2026x_port_ops = {
> + .set_pio_mode = pdc202xx_set_pio_mode,
> + .set_dma_mode = pdc202xx_set_mode,
> + .quirkproc = pdc202xx_quirkproc,
> + .resetproc = pdc202xx_reset,
> + .cable_detect = pdc2026x_cable_detect,
> +};
> +
> #define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \
> { \
> .name = name_str, \
> @@ -364,6 +359,7 @@ static void __devinit pdc202ata4_fixup_i
> .init_hwif = init_hwif_pdc202xx, \
> .init_dma = init_dma_pdc202xx, \
> .extra = 48, \
> + .port_ops = &pdc2026x_port_ops, \
> .host_flags = IDE_HFLAGS_PDC202XX | extra_flags, \
> .pio_mask = ATA_PIO4, \
> .mwdma_mask = ATA_MWDMA2, \
> @@ -376,6 +372,7 @@ static const struct ide_port_info pdc202
> .init_chipset = init_chipset_pdc202xx,
> .init_hwif = init_hwif_pdc202xx,
> .init_dma = init_dma_pdc202xx,
> + .port_ops = &pdc20246_port_ops,
> .extra = 16,
> .host_flags = IDE_HFLAGS_PDC202XX,
> .pio_mask = ATA_PIO4,
MBR, Sergei
prev parent reply other threads:[~2009-06-02 19:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-23 20:16 [PATCH 4/4] ide: add struct ide_port_ops Bartlomiej Zolnierkiewicz
2008-03-09 17:43 ` Sergei Shtylyov
2009-06-02 19:42 ` Sergei Shtylyov [this message]
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=4A2580AA.7090308@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).