From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH 3/9] ide: move IRQ clearing from ack_intr() method to clear_irq() method
Date: Fri, 12 Jun 2009 21:25:21 +0200 [thread overview]
Message-ID: <200906122125.22127.bzolnier@gmail.com> (raw)
In-Reply-To: <4A32A776.1080809@ru.mvista.com>
On Friday 12 June 2009 21:07:34 Sergei Shtylyov wrote:
> Hello.
>
> Bartlomiej Zolnierkiewicz wrote:
>
> >>>> There are now two methods that clear the port interrupt: ack_intr() method,
> >>>> implemented only on M680x0 machines, that is called at the start of ide_intr(),
> >>>> and clear_irq() method, that is called somewhat later in this function. In
> >>>> order to stop this duplication, delegate the task of clearing the interrupt
> >>>> to clear_irq() method, only leaving to ack_intr() the task of testing for the
> >>>> port interrupt. This involves moving clear_irq() method call in ide_intr()
> >>>> closer to the beginning of the function and removing ack_intr() method call
> >>>> in ide_timer_expiry(), now becoming useless...
> >>>>
> >>>> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> >>>>
> >>>> ---
> >>>> The patch is atop of ide-2.6.git 'for-next' branch.
> >>>>
> >>>> drivers/ide/gayle.c | 23 +++++++++++------------
> >>>> drivers/ide/ide-io.c | 11 ++++-------
> >>>> drivers/ide/macide.c | 18 ++++++++++++++----
> >>>> 3 files changed, 29 insertions(+), 23 deletions(-)
> >>>>
> >>>> Index: ide-2.6/drivers/ide/gayle.c
> >>>> ===================================================================
> >>>> --- ide-2.6.orig/drivers/ide/gayle.c
> >>>> +++ ide-2.6/drivers/ide/gayle.c
> >>>> @@ -66,7 +66,7 @@ MODULE_PARM_DESC(doubler, "enable suppor
> >>>> * Check and acknowledge the interrupt status
> >>>> */
> >>>>
> >>>> -static int gayle_ack_intr_a4000(ide_hwif_t *hwif)
> >>>> +static int gayle_ack_intr(ide_hwif_t *hwif)
> >>>> {
> >>>> unsigned char ch;
> >>>>
> >>>> @@ -76,16 +76,12 @@ static int gayle_ack_intr_a4000(ide_hwif
> >>>> return 1;
> >>>> }
> >>>>
> >>>> -static int gayle_ack_intr_a1200(ide_hwif_t *hwif)
> >>>> +static void gayle_a1200_clear_irq(ide_drive_t *drive)
> >>>> {
> >>>> - unsigned char ch;
> >>>> + ide_hwif_t *hwif = drive->hwif;
> >>>>
> >>>> - ch = z_readb(hwif->io_ports.irq_addr);
> >>>> - if (!(ch & GAYLE_IRQ_IDE))
> >>>> - return 0;
> >>>> (void)z_readb(hwif->io_ports.status_addr);
> >>>> z_writeb(0x7c, hwif->io_ports.irq_addr);
> >>>> - return 1;
> >>>> }
> >>>>
> >>>>
> >>> buddha.c needs a similar treatment
> >>>
> >>>
> >> Do you mean this fragment of xsurf_ack_intr()?
> >>
> >
> > Yes.
> >
>
> OK, I'm taking your word for it.
Don't take my word on it, jut cc: m68k guys. :)
> >> /* X-Surf needs a 0 written to IRQ register to ensure ISA bit A11 stays at 0 */
> >> z_writeb(0, hwif->io_ports.irq_addr);
> >>
>
> Ah, that's "A11", not "All"
lol
> >>
> >> I felt doubtful about it and decided to leave it as is.
> >>
> >>
> >>>> --- ide-2.6.orig/drivers/ide/ide-io.c
> >>>> +++ ide-2.6/drivers/ide/ide-io.c
> >>>>
> >>>>
> >>>
> >>>
> >>>> @@ -791,6 +789,10 @@ irqreturn_t ide_intr (int irq, void *dev
> >>>> goto out;
> >>>>
> >>>> handler = hwif->handler;
> >>>> + drive = hwif->cur_dev;
> >>>> +
> >>>> + if (hwif->port_ops && hwif->port_ops->clear_irq)
> >>>> + hwif->port_ops->clear_irq(drive);
> >>>>
> >>>>
> >>> We need to check for valid ->handler before using ->cur_dev
> >>> (it may contain a stale value otherwise).
> >>>
> >>>
> >> Hm...
> >>
>
> Do we really care about the valid 'drive' here? Ah, we do, for the
> sake of piix.c's implementation of clear_irq(); otherwise, we really
> don't...
We want a good and maintainable design/code. Not WorksForMeToday one.
> >>> Moreover I somehow miss the point of moving ->clear_irq call here
> >>>
> >>>
> >> I moved it here because ack_intr() was clearing the interrupt at
> >> exactly *this* point.
> >>
> >
> > ack_intr() is a m68k-specific thing -- please take a look at things from
> > this perspective.
> >
>
> I'm not sure what you mean by "this perspective". I've been looked at
> it from the more common perspective from which clearing IRQ earlier also
> made sense. When the handler is missing, we always "whack" the status
> register to clear the interrupt, so it seemed consistent to also clear
> it in the controller before doing this.
>
> >>> (it should be done after we know that it is really our IRQ).
> >>>
> >> I don't think that really matters much...
> >>
> >
> > We can have ->clear_irq without ->test_irq (i.e. piix) and thus end up
> > incorrectly clearing IRQ in case of shared IRQs..
> >
>
> I doubt that you really can clear IRQ "incorrectly"... speaking of
> existing clear_irq() implementation, I should have added test_irq()
> handler to piix.c...
Depends on the low-level hardware implementation.
next prev parent reply other threads:[~2009-06-12 19:20 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-13 22:01 [PATCH] (pata-2.6 fix queue) sl82c105: rework PIO support Sergei Shtylyov
2007-02-14 19:48 ` Bartlomiej Zolnierkiewicz
2007-03-28 17:47 ` [PATCH pata-2.6] sl82c105: rework PIO support (take 2) Sergei Shtylyov
2007-03-28 18:06 ` Sergei Shtylyov
2007-04-04 19:33 ` Bartlomiej Zolnierkiewicz
2007-04-04 19:42 ` Sergei Shtylyov
2007-04-04 19:24 ` Bartlomiej Zolnierkiewicz
2009-06-08 17:46 ` [PATCH] sl82c105: add printk() logging facility Sergei Shtylyov
2009-06-08 19:56 ` Bartlomiej Zolnierkiewicz
2009-06-10 18:44 ` [PATCH 1/9] cmd64x: implement clear_irq() method Sergei Shtylyov
2009-06-12 16:16 ` Bartlomiej Zolnierkiewicz
2009-06-12 18:39 ` Sergei Shtylyov
2009-06-12 19:01 ` Bartlomiej Zolnierkiewicz
2009-06-12 19:13 ` Sergei Shtylyov
2009-06-12 19:38 ` Bartlomiej Zolnierkiewicz
2009-06-12 20:04 ` Sergei Shtylyov
2009-06-10 18:47 ` [PATCH 2/9] ide: call clear_irq() method in ide_timer_expiry() Sergei Shtylyov
2009-06-10 18:50 ` [PATCH 3/9] ide: move IRQ clearing from ack_intr() method to clear_irq() method Sergei Shtylyov
2009-06-12 16:18 ` Bartlomiej Zolnierkiewicz
2009-06-12 18:24 ` Sergei Shtylyov
2009-06-12 18:48 ` Bartlomiej Zolnierkiewicz
2009-06-12 19:07 ` Sergei Shtylyov
2009-06-12 19:17 ` Sergei Shtylyov
2009-06-12 19:25 ` Bartlomiej Zolnierkiewicz [this message]
2009-06-10 18:51 ` [PATCH 4/9] ide: move ack_intr() method into 'struct ide_port_ops' Sergei Shtylyov
2009-06-12 16:19 ` Bartlomiej Zolnierkiewicz
2009-06-12 19:24 ` Sergei Shtylyov
2009-06-10 18:58 ` [PATCH 5/9] cmd640: implement test_irq() method Sergei Shtylyov
2009-06-10 18:59 ` [PATCH 6/9] cmd64x: " Sergei Shtylyov
2009-06-10 19:01 ` [PATCH 7/9] pdc202xx_old: " Sergei Shtylyov
2009-06-12 16:20 ` Bartlomiej Zolnierkiewicz
2009-06-12 19:31 ` Sergei Shtylyov
2009-06-10 19:05 ` [PATCH 8/9] siimage: " Sergei Shtylyov
2009-06-10 20:47 ` Sergei Shtylyov
2009-06-11 18:39 ` [PATCH 7.5/9] siimage: use ide_dma_test_irq() Sergei Shtylyov
2009-06-12 16:22 ` Bartlomiej Zolnierkiewicz
2009-06-12 19:32 ` Sergei Shtylyov
2009-06-11 18:41 ` [PATCH 8/9] siimage: implement test_irq() method Sergei Shtylyov
2009-06-13 13:30 ` [PATCH 3/10] siimage: use ide_dma_test_irq() (take 2) Sergei Shtylyov
2009-06-10 19:06 ` [PATCH 9/9] sl82c105: implement test_irq() method Sergei Shtylyov
2009-06-11 17:54 ` [PATCH] sgiioc4: coding style cleanup Sergei Shtylyov
2009-06-15 16:32 ` Bartlomiej Zolnierkiewicz
2009-06-13 13:29 ` [PATCH 1/10] ide: call clear_irq() method in ide_timer_expiry() Sergei Shtylyov
2009-06-15 16:41 ` Bartlomiej Zolnierkiewicz
2009-06-13 13:30 ` [PATCH 2/10] cmd64x: implement clear_irq() method (take 2) Sergei Shtylyov
2009-06-13 13:31 ` [PATCH 4/10] ide: move IRQ clearing from ack_intr() method to " Sergei Shtylyov
2009-06-13 13:31 ` [PATCH 5/10] ide: move ack_intr() method into 'struct ide_port_ops' " Sergei Shtylyov
2009-06-13 16:15 ` Finn Thain
2009-06-14 3:37 ` Finn Thain
2009-06-13 13:34 ` [PATCH 6/10] cmd640: implement test_irq() method Sergei Shtylyov
2009-06-13 13:35 ` [PATCH 7/10] cmd64x: " Sergei Shtylyov
2009-06-13 13:38 ` [PATCH 8/10] pdc202xx_old: implement test_irq() method (take 2) Sergei Shtylyov
2010-04-12 21:07 ` Sergei Shtylyov
2009-06-13 13:38 ` [PATCH 9/10] siimage: implement test_irq() method Sergei Shtylyov
2009-06-13 13:39 ` [PATCH 10/10] sl82c105: " Sergei Shtylyov
2009-10-09 13:36 ` [PATCH] hpt366: kill unused #define's Sergei Shtylyov
2009-10-29 10:09 ` David Miller
2009-11-20 18:52 ` [PATCH] hpt366: add debounce delay to cable_detect() method Sergei Shtylyov
2009-11-20 19:45 ` Alan Cox
2009-12-07 14:57 ` Sergei Shtylyov
2010-09-25 16:49 ` Sergei Shtylyov
2009-12-07 15:03 ` [PATCH] hpt366: fix clock turnaround Sergei Shtylyov
2010-09-25 16:40 ` Sergei Shtylyov
2010-09-25 21:39 ` David Miller
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=200906122125.22127.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=sshtylyov@ru.mvista.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.