public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Richard Cochran <richardcochran@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Christoph Lameter <cl@linux.com>,
	John Stultz <johnstul@us.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH RFC 1/8] Introduce dynamic clock devices
Date: Mon, 6 Dec 2010 15:14:49 +0100	[thread overview]
Message-ID: <201012061514.50055.arnd@arndb.de> (raw)
In-Reply-To: <20101204145343.GA8390@riccoc20.at.omicron.at>

On Saturday 04 December 2010, Richard Cochran wrote:
> On Mon, Nov 08, 2010 at 07:38:41AM +0100, Arnd Bergmann wrote:
> > On Thursday 04 November 2010, Richard Cochran wrote:
> > > +struct clock_device {
> > > +   struct file_operations fops;
> > > +   struct file_operations *driver_fops;
> > > +   struct clock_device_operations *ops;
> > > +   struct cdev cdev;
> > > +   struct kref kref;
> > > +   struct mutex mux;
> > > +   void *priv;
> > > +   int index;
> > > +   bool zombie;
> > > +};
> > 
> > You should really not need the file_operations here, neither the
> > struct nor the pointer. Just define a static file_operations
> > structure containing clock_device_open and clock_device_release,
> > and whatever else you might need, then add the driver's operations
> > to clock_device_operations, and pass the clock_device pointer
> > directly to them, instead of passing the file/inode pointers.
> 
> Arnd, I'm working a revision of this series, and I am not sure I
> understand your comment.
> 
> The intent here was to allow clock drivers to register a character
> device through the clock_device API, since some clocks (hpet, rtc)
> already offer a chardev interface.
> 
> The same FD from the open character device will also be usable as a
> clockid for the generic posix clock_get/settime calls. Thus, the
> clock_device layer needs to hook into the file open/release functions.

Ok, it wasn't clear that you use this to hook the existing file
operations, I now understand why you did it this way, but I think
my point is still valid.

> Are you suggesting that I simply offer all of the functions from a
> 'struct file_operations' (sans file/inode) in the 'struct
> clock_device_operations' too?

Yes, exactly.

> I wanted to avoid duplicating the file_operations functions, so that
> future changes in those functions would automatically trickle down to
> the clock drivers.

No need, these rarely change. More importantly, if you want to offer
a consistent interface across all these, I would make the interface
as restrictive as possible rather than offering all of the file
operations. Have a look which operations are actually used by the
character devices you want to support, and then pass through the
superset of those, but not more.

	Arnd

  reply	other threads:[~2010-12-06 14:15 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04 19:26 [PATCH RFC 0/8] Dynamic clock devices Richard Cochran
2010-11-04 19:28 ` [PATCH RFC 1/8] Introduce dynamic " Richard Cochran
2010-11-08  6:38   ` Arnd Bergmann
2010-12-04 14:55     ` Richard Cochran
2010-12-06 14:14       ` Arnd Bergmann [this message]
2010-11-04 19:28 ` [PATCH RFC 2/8] clock device: convert clock_gettime Richard Cochran
2010-11-08  6:56   ` Arnd Bergmann
2010-11-09 10:26     ` Richard Cochran
2010-11-09 12:47       ` Arnd Bergmann
2010-11-09 21:37     ` john stultz
2010-11-10 10:16       ` Arnd Bergmann
2010-11-08 23:37   ` john stultz
2010-11-09  8:23     ` Richard Cochran
2010-11-09 21:10       ` john stultz
2010-11-15  9:41         ` Richard Cochran
2010-11-04 19:28 ` [PATCH RFC 3/8] clock device: convert clock_getres Richard Cochran
2010-11-04 19:29 ` [PATCH RFC 4/8] clock device: convert clock_settime Richard Cochran
2010-11-04 19:29 ` [PATCH RFC 5/8] clock device: convert timer_create Richard Cochran
2010-11-04 19:30 ` [PATCH RFC 6/8] clock device: convert timer_delete Richard Cochran
2010-11-04 19:30 ` [PATCH RFC 7/8] clock device: convert timer_gettime Richard Cochran
2010-11-04 19:30 ` [PATCH RFC 8/8] clock device: convert timer_settime Richard Cochran
2010-11-08 23:01 ` [PATCH RFC 0/8] Dynamic clock devices john stultz
2010-11-15  9:34   ` Richard Cochran
2010-11-15 10:01 ` Paul Mundt
2010-11-18 16:33   ` Richard Cochran

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=201012061514.50055.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cl@linux.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=richardcochran@gmail.com \
    --cc=tglx@linutronix.de \
    /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