Re: [PATCH v3 6/6] thunderbolt: Change TMU mode to HiFi uni-directional once DisplayPort tunneled

Gil Fine
2022-05-16T08:49:26Z

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...

--
Thanks,
Gil