From: Andrew Morton <akpm@linux-foundation.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Raghavendra Ganiga <ravi23ganiga@gmail.com>,
a.zummo@towertech.it, rtc-linux@googlegroups.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: add support for maxim dallas rtc ds1343 and ds1344
Date: Wed, 7 May 2014 15:22:13 -0700 [thread overview]
Message-ID: <20140507152213.f7eaf5644ccbb8c6059739f4@linux-foundation.org> (raw)
In-Reply-To: <20140507231529.4a3810e5@www.etchedpixels.co.uk>
On Wed, 7 May 2014 23:15:29 +0100 Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> On Wed, 7 May 2014 14:42:48 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Wed, 7 May 2014 00:33:56 +0530 Raghavendra Ganiga <ravi23ganiga@gmail.com> wrote:
> >
> > > This is a patch to add support for
> > > maxim dallas rtc ds1343 and ds1344
> > >
> > > ...
> > >
> > > +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 regmap_write(priv->map, DS1343_TRICKLE_REG, val);
> > > + }
> > > + break;
> > > +#endif
> > > + }
> >
> > Why is RTC_SET_CHARGE defined only for m32r? It seems pretty generic?
> >
> > > + return -ENOIOCTLCMD;
> > > +}
> >
> > It's possible that this should be -ENOTTY. I always forget the rule,
> > but Alan never forgets anything ;)
>
> I forget lots 8)
>
> -ENOTTY if it will be returned to user space, -ENOIOCTLCMD is used by
> some core code internally as a way for the sub drivers to tell the core
> "I didn't handle this, maybe you have a default method ?"
Ah OK, thanks.
drivers/rtc/rtc-dev.c does
default:
/* Finally try the driver's ioctl interface */
if (ops->ioctl) {
err = ops->ioctl(rtc->dev.parent, cmd, arg);
if (err == -ENOIOCTLCMD)
err = -ENOTTY;
} else
err = -ENOTTY;
so ENOIOCTLCMD is appropriate here.
Even though rtc is upside down - it prioritises the core's ioctl
parsing ahead of the drivers'.
next prev parent reply other threads:[~2014-05-07 22:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 19:03 Raghavendra Ganiga
2014-05-07 21:42 ` Andrew Morton
2014-05-07 22:15 ` Alan Cox
2014-05-07 22:22 ` Andrew Morton [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-04-30 16:25 Raghavendra Ganiga
2014-04-30 20:35 ` Alessandro Zummo
2014-04-13 14:42 RAGHAVENDRA GANIGA
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=20140507152213.f7eaf5644ccbb8c6059739f4@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=a.zummo@towertech.it \
--cc=alan@lxorguk.ukuu.org.uk \
--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®