mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: RAGHAVENDRA GANIGA <ravi23ganiga@gmail.com>
Cc: a.zummo@towertech.it, linux-kernel@vger.kernel.org,
	rtc-linux@googlegroups.com
Subject: Re: [rtc-linux] [PATCH] rtc: add support for maxim dallas rtc ds1343 and ds1344
Date: Mon, 14 Apr 2014 18:35:19 +0100	[thread overview]
Message-ID: <20140414173519.GC25182@sirena.org.uk> (raw)
In-Reply-To: <534AA271.5010303@gmail.com>

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

On Sun, Apr 13, 2014 at 08:12:57PM +0530, RAGHAVENDRA GANIGA wrote:

> +static const struct spi_device_id ds1343_id[] = {
> +	{ "ds1343", 0 },
> +	{ "ds1344", 1 },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(spi, ds1343_id);

If the 0 and 1 mean anything there they should have #defines, otherwise
just omit them.

> +static int ds1343_get_reg(struct device *dev, unsigned char address,
> +				unsigned char *buf)
> +{
> +	struct spi_device *spi = to_spi_device(dev);
> +
> +	/* MSB of the spi address                        _
> +	   in this rtc should be zero for read operation R/W */
> +	*buf = address;
> +
> +	return spi_write_then_read(spi, buf, 1, buf, 1);
> +}

This and the set_reg() function look like you should be using regmap.

> +static int ds1343_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
> +{
> +	switch (cmd) {
> +#ifdef RTC_SET_CHARGE
> +	case RTC_SET_CHARGE:
> +	{
> +		int val;
> +
> +		if (copy_from_user(&val, (int __user *)arg, sizeof(int)))
> +			return -EFAULT;
> +
> +		return ds1343_set_reg(dev, DS1343_TRICKLE_REG, val);
> +	}
> +	break;
> +#endif
> +	}

What defines this?  I notice that ds1302 also does this - is this device
different enouh to need a separate driver?

> +static irqreturn_t ds1343_irq(int irq, void *dev_id)
> +{
> +	struct ds1343_priv *priv = dev_id;
> +
> +	disable_irq_nosync(irq);
> +	schedule_work(&priv->work);
> +	return IRQ_HANDLED;
> +}

Use request_threaded_irq() rather than open coding it.

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

      reply	other threads:[~2014-04-14 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-13 14:42 RAGHAVENDRA GANIGA
2014-04-14 17:35 ` Mark Brown [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=20140414173519.GC25182@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ravi23ganiga@gmail.com \
    --cc=rtc-linux@googlegroups.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

all inboxes | Powered by JetHome®