public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	grant.likely@secretlab.ca, jamie@jamieiles.com,
	akpm@linux-foundation.org, rmk+kernel@arm.linux.org.uk
Subject: Re: basic_mmio_gpio: Add hook for simple debounce register
Date: Thu, 17 Nov 2011 01:40:07 +0400	[thread overview]
Message-ID: <20111116214007.GA26380@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <201111161202.15485.hartleys@visionengravers.com>

Hello,

On Wed, Nov 16, 2011 at 12:02:15PM -0700, H Hartley Sweeten wrote:
> Some platforms using the basic memory-mapped GPIO library have
> simple input debounce support that is enabled/disabled, per-input,
> by setting/clearing bits in a control register. Add a hook in the
> bgpio_chip structure to hold the void __iomem * for this register.
> 
> This register, and the gc.set_debounce callback should set by the
> platform after calling bgpio_init() and before calling gpiochip_add().

I think it is possible to add 'reg_db' into the device-specific
(private) structure, so no need to add it into the generic one
(the fact that the generic gpio code does not use it at all, is a
sign that you should place it into a private struct).

I.e. something like this:

struct foo_chip {
	struct bgpio_chip bgc;
	void __iomem *reg_db;
};

static struct foo_chip *to_foo_chip(struct bgpio_chip *bgc)
{
	return container_of(bgc, struct foo_chip, bgc);
}

static void foo_gpio_set_debounce(struct gpio_chip *gc, ...)
{
	struct bgpio_chip *bgc = to_bgpio_chip(gc);
	struct foo_chip *fgc = to_foo_chip(bgc);

	writel(..., fgc->reg_db);
}


Or, if the generic code will use that register, then please introduce
the code at the same time you introduce reg_db.

Thanks,

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

  reply	other threads:[~2011-11-16 21:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16 19:02 basic_mmio_gpio: Add hook for simple debounce register H Hartley Sweeten
2011-11-16 21:40 ` Anton Vorontsov [this message]
2011-11-16 22:41   ` H Hartley Sweeten

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=20111116214007.GA26380@oksana.dev.rtsoft.ru \
    --to=cbouatmailru@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=grant.likely@secretlab.ca \
    --cc=hartleys@visionengravers.com \
    --cc=jamie@jamieiles.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    /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