From: Greg KH <greg@kroah.com>
To: Drew Abbott <abbotta4@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Accessing a pdev or its members
Date: Sat, 25 Sep 2021 08:31:33 +0200 [thread overview]
Message-ID: <YU7CRbnRMYEwGl/n@kroah.com> (raw)
In-Reply-To: <CALY-g87TyQ6wi+RP4fp5PFA3z=Ou7ZMEkeRGMmC4AGdjwt1tcg@mail.gmail.com>
On Fri, Sep 24, 2021 at 09:30:55PM -0500, Drew Abbott wrote:
> Hello all,
>
> A third party driver has a probe function foo_probe(struct
> platform_device) that ends up allocating and initializing a list of
> various device structs:
>
> struct device *dev = &pdev->dev;
> struct ucsi_dev *udev;
> udev = devm_kzalloc(dev, sizeof(*udev), GFP_KERNEL);
> /* initialize udev to important data */
> platform_set_drvdata(pdev, udev);
>
> I have my own driver that I would like to use to access the *udev that
> is created when the other device is probed. How would I access a pdev?
You can not, it is not owned by your driver and the lifetime rules
should not give you access to it.
Why would you want to poke around in a platform device that is
controlled by a different driver? What does your driver want to do?
> Or is there a way I can add a function to this driver to expose a
> *udev? I can't seem to get to it without having a pointer to the pdev,
> the udev, or some other device struct related to the hardware.
Why not move your functionality into the existing driver if you need to
talk to the same hardware device?
thanks,
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
prev parent reply other threads:[~2021-09-25 6:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-25 2:30 Accessing a pdev or its members Drew Abbott
2021-09-25 6:31 ` 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=YU7CRbnRMYEwGl/n@kroah.com \
--to=greg@kroah.com \
--cc=abbotta4@gmail.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 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).