lkml.org 
[lkml]   [2022]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [char-misc-next] mei: gsc_proxy: add gsc proxy driver
Date
> 
> Why a whole new subdirectory for a tiny 200 line file?
>
All drivers for devices on mei bus have private subdirectory.
This one just modelled on the existing examples.
If you say that this is not a good thing - can put it in the main mei directory.

> > +static int mei_gsc_proxy_component_match(struct device *dev, int
> subcomponent, void *data)
> > +{
> > + struct device *base = data;
> > +
> > + if (!dev || !dev->driver ||
> > + strcmp(dev->driver->name, "i915") ||
>
> I thought I had objected to this "let's poke around in a driver name for
> a magic value" logic in the past. How do you know this is always going
> to work?

All components that serve Intel graphics integrated into PCH should check
in their match that calling device is graphic card sitting on the same PCH.
The code below checks that i915 pci device and mei pci device (grandparent of our device on mei bus)
are children of the same parent, but there is no way to know if caller
is, indeed, graphic device. Easiest way is to check well-known device river name.
All i915 components doing this comparison.
This is a simplified scheme of relations between devices here:
/--- MEI PCI --- MEI --- GSC_PROXY
PCH ---
\--- GRAPHIC PCI --- I915
>
> > + subcomponent != I915_COMPONENT_GSC_PROXY)
> > + return 0;
> > +
> > + base = base->parent;
> > + if (!base) /* mei device */
> > + return 0;
>
> How can a device not have a parent?

This one should be proxy device on mei bus, so parent should be there always, can drop this check.

>
> > +
> > + base = base->parent; /* pci device */
>
> You don't know this is a pci device :(

This is more, like, note to explain on what level in above scheme we are now.
It should be mei pci device for match to succeed.

>
> If it is, then pass in a REAL pci device structure please.
>
> > +
> > + dev = dev->parent;
> > + return (base && dev && dev == base);
>
> I do not understand this statement at all, what are you doing here?
>
> confused,

Hope that scheme above explains the relations between devices.
>
> greg k-h


--
Thanks,
Sasha


\
 
 \ /
  Last update: 2023-03-26 23:22    [W:0.073 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site