linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org,
	Samu Onkalo <samu.p.onkalo@nokia.com>,
	michael.opdenacker@free-electrons.com,
	gregory.clement@free-electrons.com,
	maxime.ripard@free-electrons.com,
	alexandre.belloni@free-electrons.com
Subject: Re: [PATCH] char: misc: assign file->private_data in all cases
Date: Tue, 25 Jun 2013 11:59:44 +0200	[thread overview]
Message-ID: <20130625115944.28fc447b@skate> (raw)
In-Reply-To: <20130624222642.GA24099@kroah.com>

Dear Greg Kroah-Hartman,

On Mon, 24 Jun 2013 15:26:42 -0700, Greg Kroah-Hartman wrote:

> > However, this assignment was only done when the misc driver was
> > declaring a driver-specific ->open() operation in its
> > file_operations. This doesn't make sense, as the driver may not
> > necessarily have a custom ->open() operation, and might still be
> > interested in having file->private_data properly set for use in its
> > ->read() and write() operations.
> > 
> > Therefore, we move the assignment of file->private_data outside of the
> > condition that tests whether a driver-specific ->open() operation was
> > defined.
> 
> Does this solve a problem with an existing misc driver?  Or are you just
> trying to be "safe" for future, broken, drivers?

This problem was spotted while implementing a dummy/example misc driver
for training purposes. I am not aware of any mainline misc driver
affected by this problem, but I haven't reviewed all misc drivers.

It simply seems to make sense to implement the feature of fa1f68db6ca
("drivers: misc: pass miscdevice pointer via file private data") in a
way that also allows misc drivers that do not provide their own
->open() operation to use it.

That said, I'm not sure why you call such drivers 'broken'.

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

      reply	other threads:[~2013-06-25  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 13:01 [PATCH] char: misc: assign file->private_data in all cases Thomas Petazzoni
2013-06-21 13:25 ` Arnd Bergmann
2013-06-24 22:26 ` Greg Kroah-Hartman
2013-06-25  9:59   ` Thomas Petazzoni [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=20130625115944.28fc447b@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=michael.opdenacker@free-electrons.com \
    --cc=samu.p.onkalo@nokia.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;
as well as URLs for NNTP newsgroup(s).