From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Gil Fine <gil.fine@intel.com>
Cc: andreas.noever@gmail.com, michael.jamet@intel.com,
YehezkelShB@gmail.com, linux-usb@vger.kernel.org,
lukas@wunner.de
Subject: Re: [PATCH v3 6/6] thunderbolt: Change TMU mode to HiFi uni-directional once DisplayPort tunneled
Date: Mon, 16 May 2022 12:34:06 +0300 [thread overview]
Message-ID: <YoIajuneoVCCcfGZ@lahna> (raw)
In-Reply-To: <20220516085903.GC8368@ccdjLinux26>
On Mon, May 16, 2022 at 11:59:03AM +0300, Gil Fine wrote:
> Hi Mika,
>
> On Mon, May 16, 2022 at 11:34:15AM +0300, Mika Westerberg wrote:
> > Hi Gil,
> >
> > On Sun, May 15, 2022 at 11:27:46PM +0300, Gil Fine wrote:
> > > > > +int tb_switch_tmu_config_enable(struct device *dev, void *data)
> > > >
> > > > Also can we please make it take some real type and not something
> > > > arbitrary?
> > > You mean the names, right?
> > > Something like:
> > > int tb_switch_tmu_config_enable(struct device *parent, void *rate)
> > > If so, yes, I will
> >
> > I mean use a real type, not void *.
> >
> > > >
> > > > Can it be const too?
> > > IIUC, it shall be a function pointer with specified signature otherwise it will fail
> > > at compilation
> >
> > Okay then I suggest to make a reasonable "API" function that handles
> > all this internally that does not take arbitrary pointers. Remember to
> > document it in kernel-doc too.
>
> This is a function pointer that shall be passed to device_for_each_child()
> And it has to be defined as:
>
> int (*fn)(struct device *dev, void *data)
>
> Similar as here e.g.:
>
> static int remove_retimer(struct device *dev, void *data)
> {
> »·······struct tb_retimer *rt = tb_to_retimer(dev);
> »·······struct tb_port *port = data;
>
> »·······if (rt && rt->port == port)
> »·······»·······tb_retimer_remove(rt);
> »·······return 0;
> }
>
> void tb_retimer_remove_all(struct tb_port *port)
> {
> »·······struct usb4_port *usb4;
>
> »·······usb4 = port->usb4;
> »·······if (usb4)
> »·······»·······device_for_each_child_reverse(&usb4->dev, port,
> »·······»·······»·······»·······»······· remove_retimer);
> }
>
> So not sure I get you...
The difference is that above it is static function not exposed outside
of that file and used directly below its implementation.
In your case you make it non-static "API" function exported from tmu.c
and called from tb.c.
So instead I suggest to put the device_for_each_child() in tmu.c and
then the tb_switch_tmu_config_enable() static right above it. Please
also name the resulting API function consistently.
next prev parent reply other threads:[~2022-05-16 9:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 14:05 [PATCH v3 0/6] thunderbolt: CL1 support for USB4 and Titan Ridge Gil Fine
2022-05-11 14:05 ` [PATCH v3 1/6] thunderbolt: Silently ignore CLx enabling in case CLx is not supported Gil Fine
2022-05-11 14:05 ` [PATCH v3 2/6] thunderbolt: CLx disable before system suspend only if previously enabled Gil Fine
2022-05-11 14:05 ` [PATCH v3 3/6] thunderbolt: Fix typos in CLx enabling Gil Fine
2022-05-11 14:05 ` [PATCH v3 4/6] thunderbolt: Change downstream router's TMU rate in both TMU uni/bidir mode Gil Fine
2022-05-11 14:05 ` [PATCH v3 5/6] thunderbolt: Add CL1 support for USB4 and Titan Ridge routers Gil Fine
2022-05-11 14:05 ` [PATCH v3 6/6] thunderbolt: Change TMU mode to HiFi uni-directional once DisplayPort tunneled Gil Fine
2022-05-13 9:53 ` Mika Westerberg
2022-05-15 20:27 ` Gil Fine
2022-05-16 8:34 ` Mika Westerberg
2022-05-16 8:59 ` Gil Fine
2022-05-16 9:34 ` Mika Westerberg [this message]
2022-05-16 13:21 ` Gil Fine
2022-05-16 13:19 ` Mika Westerberg
2022-05-16 13:45 ` Gil Fine
2022-05-16 13:43 ` Greg KH
2022-05-16 14:54 ` Mika Westerberg
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=YoIajuneoVCCcfGZ@lahna \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=gil.fine@intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=michael.jamet@intel.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).