All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: Mark Jackson <mpfj-kZtEnBLzDKq1Qrn1Bg8BZw@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Alessandro Zummo
	<alessandro.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
	dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [PATCH v6] Add Dallas DS1390/93/94 RTC chips
Date: Mon, 10 Nov 2008 14:49:17 -0800	[thread overview]
Message-ID: <200811101449.17972.david-b@pacbell.net> (raw)
In-Reply-To: <4912B459.2020704-kZtEnBLzDKq1Qrn1Bg8BZw@public.gmane.org>

On Thursday 06 November 2008, Mark Jackson wrote:
> v6 (!!) of this patch with even more code tidying as per previous comments.
> Also only a single tx/rx buffer is used.
> Now uses spi_write_then_read()
> Comments changed to include extra chips in the family
> 
> This patch adds support for the Dallas DS1390/93/94 SPI RTC chip.
> 
> Signed-off-by: Mark Jackson <mpfj-kZtEnBLzDKq1Qrn1Bg8BZw@public.gmane.org>

Acked-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

Although I wouldn't bother using the "wday" field at all.
Linux doesn't use that field, so trying to maintain it isn't
useful ... though it probably doesn't hurt, assuming the
chip behaves OK when invalid data is written there.


Also, in probe():

> +       printk(KERN_INFO "DS1390 SPI RTC driver\n");

I dislike those banners in general.  Best to remove that,
since the RTC framework announces the registration.  Or
at least, dev_info().


> +	spi->mode = SPI_MODE_3;
> +	spi->bits_per_word = 8;
> +	spi_setup(spi);

Unlikely to fail ... but 

	res = spi_setup(spi);
	if (res < 0) {
		/* or do it before the kzalloc, no kfree
		 * ... likewise with reading the register
		 * as an "is it there" check:  do it earlier
		 * and get a similar minor codeshrink.
		 */
		kfree(chip);
		return res;
	}

> +
> +	dev_set_drvdata(&spi->dev, chip);
> +
> +	res = ds1390_get_reg(&spi->dev, DS1390_REG_SECONDS, &tmp);
> +	if (res) {
> +		dev_err(&spi->dev, "DS1390: unable to read device\n");
> +		kfree(chip);
> +		return res;
> +	}
> +
> +	rtc = rtc_device_register("ds1390",
> +				&spi->dev, &ds1390_rtc_ops, THIS_MODULE);

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

WARNING: multiple messages have this Message-ID (diff)
From: David Brownell <david-b@pacbell.net>
To: Mark Jackson <mpfj@mimc.co.uk>
Cc: dbrownell@users.sourceforge.net,
	lkml <linux-kernel@vger.kernel.org>,
	Alessandro Zummo <alessandro.zummo@towertech.it>,
	rtc-linux@googlegroups.com,
	spi-devel-general@lists.sourceforge.net
Subject: Re: [PATCH v6] Add Dallas DS1390/93/94 RTC chips
Date: Mon, 10 Nov 2008 14:49:17 -0800	[thread overview]
Message-ID: <200811101449.17972.david-b@pacbell.net> (raw)
In-Reply-To: <4912B459.2020704@mimc.co.uk>

On Thursday 06 November 2008, Mark Jackson wrote:
> v6 (!!) of this patch with even more code tidying as per previous comments.
> Also only a single tx/rx buffer is used.
> Now uses spi_write_then_read()
> Comments changed to include extra chips in the family
> 
> This patch adds support for the Dallas DS1390/93/94 SPI RTC chip.
> 
> Signed-off-by: Mark Jackson <mpfj@mimc.co.uk>

Acked-by: David Brownell <dbrownell@users.sourceforge.net>

Although I wouldn't bother using the "wday" field at all.
Linux doesn't use that field, so trying to maintain it isn't
useful ... though it probably doesn't hurt, assuming the
chip behaves OK when invalid data is written there.


Also, in probe():

> +       printk(KERN_INFO "DS1390 SPI RTC driver\n");

I dislike those banners in general.  Best to remove that,
since the RTC framework announces the registration.  Or
at least, dev_info().


> +	spi->mode = SPI_MODE_3;
> +	spi->bits_per_word = 8;
> +	spi_setup(spi);

Unlikely to fail ... but 

	res = spi_setup(spi);
	if (res < 0) {
		/* or do it before the kzalloc, no kfree
		 * ... likewise with reading the register
		 * as an "is it there" check:  do it earlier
		 * and get a similar minor codeshrink.
		 */
		kfree(chip);
		return res;
	}

> +
> +	dev_set_drvdata(&spi->dev, chip);
> +
> +	res = ds1390_get_reg(&spi->dev, DS1390_REG_SECONDS, &tmp);
> +	if (res) {
> +		dev_err(&spi->dev, "DS1390: unable to read device\n");
> +		kfree(chip);
> +		return res;
> +	}
> +
> +	rtc = rtc_device_register("ds1390",
> +				&spi->dev, &ds1390_rtc_ops, THIS_MODULE);

  parent reply	other threads:[~2008-11-10 22:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-06  9:09 [PATCH v6] Add Dallas DS1390/93/94 RTC chips Mark Jackson
2008-11-06  9:09 ` Mark Jackson
2008-11-06 17:42 ` [rtc-linux] " Alessandro Zummo
     [not found] ` <4912B459.2020704-kZtEnBLzDKq1Qrn1Bg8BZw@public.gmane.org>
2008-11-10 22:49   ` David Brownell [this message]
2008-11-10 22:49     ` David Brownell

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=200811101449.17972.david-b@pacbell.net \
    --to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
    --cc=alessandro.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mpfj-kZtEnBLzDKq1Qrn1Bg8BZw@public.gmane.org \
    --cc=rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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.