mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Doug Berger <opendmb@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	mans@mansr.com, Bartosz Golaszewski <brgl@bgdev.pl>,
	Sebastian Frias <sf84@laposte.net>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/6] genirq: generic chip: add generic irq_mask_ack functions
Date: Mon, 17 Jul 2017 10:23:59 -0700	[thread overview]
Message-ID: <bd8fcf36-70df-7bf6-06e5-adfd4a5d2f5c@gmail.com> (raw)
In-Reply-To: <1ccd2ce6-ac51-afed-f8be-f453f18b5464@gmail.com>

On 07/10/2017 10:39 AM, Doug Berger wrote:
> On 07/08/2017 05:08 AM, Thomas Gleixner wrote:
>> On Fri, 7 Jul 2017, Doug Berger wrote:
>>
>>> The irq_gc_mask_disable_reg_and_ack() function name implies that it
>>> provides the combined functions of irq_gc_mask_disable_reg() and
>>> irq_gc_ack().  However, the implementation does not actually do
>>> that since it writes the mask instead of the disable register. It
>>> also does not maintain the mask cache which makes it inappropriate
>>> to use with other masking functions.
>>>
>>> In addition, commit 659fb32d1b67 ("genirq: replace irq_gc_ack() with
>>> {set,clr}_bit variants (fwd)") effectively renamed irq_gc_ack() to
>>> irq_gc_set_bit() so this function probably should have also been
>>> renamed at that time.
>>>
>>> Since this generic chip code provides three mask functions and two
>>> ack functions, this commit provides generic implementations for all
>>> six combinations of the mask and ack functions suitable for use
>>> with the irq_mask_ack member of the struct irq_chip.
>>
>> We have exactly one user of irq_gc_mask_disable_reg_and_ack() and that
>> needs exactly on function as replacement. Why do we need 6 variants of
>> that right now?
> 
> This is merely a suggestion.
> 
> When I was originally adding support for the BCM7271 variant of the
> irq-brcmstb-l2 interrupt controller I noticed that providing an
> irq_mask_ack implementation would be slightly more efficient than only
> providing irq_mask and irq_ack.  I assumed that it was philosophically
> better to use a generic chip implementation than creating yet another
> driver specific version of the method.
> 
> This task was originally done on a downstream development kernel derived
> from the v4.1 kernel and I'm finally taking the opportunity to attempt
> to upstream the change.  At that time, I was drawn to the
> irq_gc_mask_disable_reg_and_ack() function based on the name, but I
> discovered that it was actually using the mask register rather than the
> disable register contrary to its name and hadn't been included in the
> changes when mask caching was added and when some similar functions were
> renamed.  I considered submitting a patch to correct what I perceived as
> a bug, but after discovering there were no users of the function at that
> time I decided that it should probably be removed and replaced with the
> irq_gc_mask_disable_and_ack_set() function that I needed.
> 
> While preparing the upstream submission I discovered that the tango
> interrupt controller driver had apparently started using the potentially
> problematic function.  I'm not comfortable making changes to drivers for
> devices that I'm not able to test (I'm still making mistakes with git
> send-email --cc-cmd ;) so Florian accepted authorship of that change.
> 
> I had perhaps incorrectly assumed that the
> irq_gc_mask_disable_reg_and_ack() function was originally included in
> the generic chip implementation nearly 5 years before its first use was
> to encourage driver developers to adopt generic chip implementations
> rather than implementing unique versions in every driver.  To that end
> I'm suggesting offering all currently possible generic chip
> implementations of the irq_mask_ack method to encourage drivers to adopt
> use of generic chip methods even though I only need one of them.
> 
> Perhaps someone bolder than I may be inspired to undertake converting
> more irqchip drivers to use these methods.
> 
> If I am mistaken and this is an undesired change I am happy to implement
> an irq-brcmstb-l2 driver specific implementation of the irq_mask_ack
> method or just changing the single function.
> 
>>
>> Thanks,
>>
>> 	tglx
>>
> 
> Thanks for your consideration and please let me know how you would like
> me to proceed with the submission.
>     Doug
> 

Seeing as Mans has acked the change to his driver should I submit a V2
with just the function he and I are using and remove the other five
permutations, or are you willing to move forward with the patch as is?

Thanks,
    Doug

  reply	other threads:[~2017-07-17 17:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170707192016.13001-1-opendmb@gmail.com>
2017-07-07 19:20 ` Doug Berger
2017-07-08 12:08   ` Thomas Gleixner
2017-07-10 17:39     ` Doug Berger
2017-07-17 17:23       ` Doug Berger [this message]
2017-07-17 20:58         ` Thomas Gleixner
2017-07-12 19:24   ` Doug Berger
2017-07-12 20:49     ` Måns Rullgård
2017-07-07 19:20 ` [PATCH 2/6] irqchip/tango: Use irq_gc_mask_disable_and_ack_set Doug Berger
2017-07-12 12:34   ` Marc Gonzalez
2017-07-13 10:16     ` Måns Rullgård
2017-07-07 19:20 ` [PATCH 3/6] genirq: generic chip: remove irq_gc_mask_disable_reg_and_ack() Doug Berger
2017-07-07 19:20 ` [PATCH 4/6] irqchip: brcmstb-l2: Remove some processing from the handler Doug Berger
2017-07-10 15:53   ` Florian Fainelli
2017-07-07 19:20 ` [PATCH 5/6] irqchip: brcmstb-l2: Abstract register accesses Doug Berger
2017-07-10 15:54   ` Florian Fainelli
2017-07-07 19:20 ` [PATCH 6/6] irqchip: brcmstb-l2: Add support for the BCM7271 L2 controller Doug Berger
2017-07-10 15:53   ` Rob Herring
2017-07-10 15:54   ` Florian Fainelli
2017-07-07 19:34 ` [PATCH 0/6] Add support for BCM7271 style interrupt controller Doug Berger
2017-07-07 19:39   ` Florian Fainelli

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=bd8fcf36-70df-7bf6-06e5-adfd4a5d2f5c@gmail.com \
    --to=opendmb@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=brgl@bgdev.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mans@mansr.com \
    --cc=marc.zyngier@arm.com \
    --cc=sf84@laposte.net \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome