All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: kernelnewbies@kernelnewbies.org
Subject: Re: platform device as parent of a miscdevice
Date: Tue, 30 Mar 2021 22:09:09 +0200	[thread overview]
Message-ID: <YGOFZblQpF2Yt0G8@kroah.com> (raw)
In-Reply-To: <20210330192717.aua2loxmypqoehsp@viti.kaiser.cx>

On Tue, Mar 30, 2021 at 09:27:17PM +0200, Martin Kaiser wrote:
> > What in-kernel misc drivers do not do that that you feel should?
> 
> My misunderstanding was that quite a few drivers set the parent pointer
> but hardly anyone uses the parent pointer in the file_operations.

What parent pointer in struct file_operations?  I don't see one...

> It seems that most drivers have their miscdevice as part of their global
> structure and use container_of in the file_operations, e.g. ipmb_read in
> drivers/char/ipmi/ipmb_dev_int.c.

That's one way to use it, there are I think at least 3 ways to use it,
maybe more...

Don't confuse the struct device parent pointer with the private pointer
to get back to your local device-specific data.  They are different
things.

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2021-03-30 20:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 16:04 platform device as parent of a miscdevice Martin Kaiser
2021-03-30 16:49 ` Greg KH
2021-03-30 19:27   ` Martin Kaiser
2021-03-30 20:09     ` Greg KH [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=YGOFZblQpF2Yt0G8@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.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.