mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: "Kim, Milo" <Milo.Kim@ti.com>
Cc: "sameo@linux.intel.com" <sameo@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Girdwood, Liam" <lrg@ti.com>,
	Anton Vorontsov <cbouatmailru@gmail.com>,
	"dwmw2@infradead.org" <dwmw2@infradead.org>,
	"a.zummo@towertech.it" <a.zummo@towertech.it>,
	Andrew Morton <akpm@linux-foundation.org>,
	Richard Purdie <rpurdie@rpsys.net>,
	Bryan Wu <bryan.wu@canonical.com>
Subject: Re: [PATCH 1/6] mfd: add lp8788 mfd driver
Date: Wed, 18 Jul 2012 15:50:32 +0100	[thread overview]
Message-ID: <20120718145032.GB4495@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <A874F61F95741C4A9BA573A70FE3998FD79B@DQHE02.ent.ti.com>

[-- Attachment #1: Type: text/plain, Size: 1886 bytes --]

On Wed, Jul 18, 2012 at 02:32:40PM +0000, Kim, Milo wrote:

> +struct lp8788_irq_data {
> +	struct lp8788 *lp;
> +	struct irq_domain *irqdm;
> +	struct mutex irq_lock;
> +	struct delayed_work work;
> +	struct workqueue_struct *thread;
> +	int enabled[LP8788_INT_MAX];
> +	int irq;
> +	int irq_base;
> +};

Can you use regmap-irq?  If not can we fix things so that's possible?

> +static irqreturn_t lp8788_irq_handler(int irq, void *ptr)
> +{
> +	struct lp8788_irq_data *irqd = ptr;
> +	unsigned long delay = msecs_to_jiffies(DEBOUNCE_MSEC);
> +
> +	queue_delayed_work(irqd->thread, &irqd->work, delay);
> +
> +	return IRQ_HANDLED;
> +}

Why a delayed work?  That's *very* unusual.

> +	if (!lp->pdata) {
> +		dev_warn(lp->dev, "no platform data for irq\n");
> +		goto no_err;
> +	}

Given that you're using irq domains why does the device need platform
data?

> +	if (irq_base) {
> +		irq_base = irq_alloc_descs(irq_base, 0, LP8788_INT_MAX, 0);
> +		if (irq_base < 0) {
> +			dev_warn(lp->dev, "no allocated irq: %d\n", irq_base);
> +			goto no_err;
> +		}
> +	}

This shouldn't be needed with irq domains.

> +EXPORT_SYMBOL(lp8788_read_byte);

You're reexporting regmap functionality with looser licensing
requirements...

> +unsigned int lp8788_get_adc(struct lp8788 *lp, enum lp8788_adc_id id,
> +			enum lp8788_adc_resolution res)

For new drivers the ADC should probably be integrated into IIO.

> +static int lp8788_add_devices(struct lp8788 *lp)
> +{
> +	int ret;
> +	int irq_base = lp->pdata ? lp->pdata->irq_base : 0;
> +
> +	ret = mfd_add_devices(lp->dev, -1, lp8788_devs, ARRAY_SIZE(lp8788_devs),
> +			NULL, irq_base);

Since you're using an irq domains you shouldn't need an irq base
specifying in order to use interrupts.

> +	if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
> +		return -EIO;

I'd expect that's going to give some false negatives...

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-07-18 14:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 14:32 Kim, Milo
2012-07-18 14:50 ` Mark Brown [this message]
2012-07-19  9:05   ` Kim, Milo
2012-08-09  8:32   ` Kim, Milo

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=20120718145032.GB4495@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=Milo.Kim@ti.com \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=bryan.wu@canonical.com \
    --cc=cbouatmailru@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=rpurdie@rpsys.net \
    --cc=sameo@linux.intel.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

Powered by JetHome