All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Guenter Roeck <linux@roeck-us.net>, Jun Li <jun.li@nxp.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [v8,01/12] drivers: base: Unified device connection lookup
Date: Tue, 20 Mar 2018 12:04:12 +0200	[thread overview]
Message-ID: <20180320100412.GI11689@kuha.fi.intel.com> (raw)

On Tue, Mar 20, 2018 at 10:20:04AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Mar 14, 2018 at 04:12:04PM +0300, Heikki Krogerus wrote:
> > Several frameworks - clk, gpio, phy, pmw, etc. - maintain
> > lookup tables for describing connections and provide custom
> > API for handling them. This introduces a single generic
> > lookup table and API for the connections.
> > 
> > The motivation for this commit is centralizing the
> > connection lookup, but the goal is to ultimately extract the
> > connection descriptions also from firmware by using the
> > fwnode_graph_* functions and other mechanisms that are
> > available.
> > 
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > ---
> > Changes in v8:
> > - No longer using rcu.
> 
> Ok, but then:
> 
> > +void *device_connection_find_match(struct device *dev, const char *con_id,
> > +			       void *data,
> > +			       void *(*match)(struct device_connection *con,
> > +					      int ep, void *data))
> > +{
> > +	const char *devname = dev_name(dev);
> > +	struct device_connection *con;
> > +	void *ret = NULL;
> > +	int ep;
> > +
> > +	if (!match)
> > +		return NULL;
> > +
> > +	mutex_lock(&devcon_lock);
> > +
> > +	list_for_each_entry_rcu(con, &devcon_list, list) {
> 
> _rcu calls everywhere :(
> 
> Did you send out the right version of this patch?
> 
> Also, further down you do:
> 
> > +#include <linux/platform_device.h>
> > +#include <linux/spi/spi.h>
> > +#include <linux/i2c.h>
> > +#include <linux/pci.h>
> 
> Eeek, #include in the middle of a file, not good.
> 
> > +
> > +static struct bus_type *generic_match_buses[] = {
> > +	&platform_bus_type,
> > +#ifdef CONFIG_PCI
> > +	&pci_bus_type,
> > +#endif
> > +#ifdef CONFIG_I2C
> > +	&i2c_bus_type,
> > +#endif
> > +#ifdef CONFIG_SPI_MASTER
> > +	&spi_bus_type,
> > +#endif
> > +	NULL,
> > +};
> 
> Can't you just declare the above as "extern" variables and not need the
> #include?  Yeah, checkpatch will complain, but it should be fine here as
> we really don't want the full .h files here (or need them.)

OK. I'll declare them as extern.

> > +void device_connection_remove(struct device_connection *con)
> > +{
> > +	mutex_lock(&devcon_lock);
> > +	list_del_rcu(&con->list);
> 
> See, rcu?

True. I'll send one more version.


Thanks,

WARNING: multiple messages have this Message-ID (diff)
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Guenter Roeck <linux@roeck-us.net>, Jun Li <jun.li@nxp.com>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH v8 01/12] drivers: base: Unified device connection lookup
Date: Tue, 20 Mar 2018 12:04:12 +0200	[thread overview]
Message-ID: <20180320100412.GI11689@kuha.fi.intel.com> (raw)
In-Reply-To: <20180320092004.GA21081@kroah.com>

On Tue, Mar 20, 2018 at 10:20:04AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Mar 14, 2018 at 04:12:04PM +0300, Heikki Krogerus wrote:
> > Several frameworks - clk, gpio, phy, pmw, etc. - maintain
> > lookup tables for describing connections and provide custom
> > API for handling them. This introduces a single generic
> > lookup table and API for the connections.
> > 
> > The motivation for this commit is centralizing the
> > connection lookup, but the goal is to ultimately extract the
> > connection descriptions also from firmware by using the
> > fwnode_graph_* functions and other mechanisms that are
> > available.
> > 
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > ---
> > Changes in v8:
> > - No longer using rcu.
> 
> Ok, but then:
> 
> > +void *device_connection_find_match(struct device *dev, const char *con_id,
> > +			       void *data,
> > +			       void *(*match)(struct device_connection *con,
> > +					      int ep, void *data))
> > +{
> > +	const char *devname = dev_name(dev);
> > +	struct device_connection *con;
> > +	void *ret = NULL;
> > +	int ep;
> > +
> > +	if (!match)
> > +		return NULL;
> > +
> > +	mutex_lock(&devcon_lock);
> > +
> > +	list_for_each_entry_rcu(con, &devcon_list, list) {
> 
> _rcu calls everywhere :(
> 
> Did you send out the right version of this patch?
> 
> Also, further down you do:
> 
> > +#include <linux/platform_device.h>
> > +#include <linux/spi/spi.h>
> > +#include <linux/i2c.h>
> > +#include <linux/pci.h>
> 
> Eeek, #include in the middle of a file, not good.
> 
> > +
> > +static struct bus_type *generic_match_buses[] = {
> > +	&platform_bus_type,
> > +#ifdef CONFIG_PCI
> > +	&pci_bus_type,
> > +#endif
> > +#ifdef CONFIG_I2C
> > +	&i2c_bus_type,
> > +#endif
> > +#ifdef CONFIG_SPI_MASTER
> > +	&spi_bus_type,
> > +#endif
> > +	NULL,
> > +};
> 
> Can't you just declare the above as "extern" variables and not need the
> #include?  Yeah, checkpatch will complain, but it should be fine here as
> we really don't want the full .h files here (or need them.)

OK. I'll declare them as extern.

> > +void device_connection_remove(struct device_connection *con)
> > +{
> > +	mutex_lock(&devcon_lock);
> > +	list_del_rcu(&con->list);
> 
> See, rcu?

True. I'll send one more version.


Thanks,

-- 
heikki

             reply	other threads:[~2018-03-20 10:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 10:04 Heikki Krogerus [this message]
2018-03-20 10:04 ` [PATCH v8 01/12] drivers: base: Unified device connection lookup Heikki Krogerus
  -- strict thread matches above, loose matches on Subject: below --
2018-03-20 12:52 [v8,01/12] " Heikki Krogerus
2018-03-20 12:52 ` [PATCH v8 01/12] " Heikki Krogerus
2018-03-20 12:21 [v8,01/12] " Hans de Goede
2018-03-20 12:21 ` [PATCH v8 01/12] " Hans de Goede
2018-03-20 10:32 [v8,01/12] " Heikki Krogerus
2018-03-20 10:32 ` [PATCH v8 01/12] " Heikki Krogerus
2018-03-20 10:32 ` Heikki Krogerus
2018-03-20  9:20 [v8,01/12] " Greg Kroah-Hartman
2018-03-20  9:20 ` [PATCH v8 01/12] " Greg Kroah-Hartman
2018-03-14 13:12 [v8,12/12] extcon: axp288: Set USB role where necessary Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 12/12] " Heikki Krogerus
2018-03-14 13:12 [v8,11/12] platform/x86: intel_cht_int33fe: Add device connections for the Type-C port Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 11/12] " Heikki Krogerus
2018-03-14 13:12 [v8,10/12] usb: typec: driver for Pericom PI3USB30532 Type-C cross switch Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 10/12] " Heikki Krogerus
2018-03-14 13:12 [v8,09/12] usb: roles: Add Intel xHCI USB role switch driver Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 09/12] " Heikki Krogerus
2018-03-14 13:12 [v8,08/12] xhci: Add Intel extended cap / otg phy mux handling Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 08/12] " Heikki Krogerus
2018-03-14 13:12 [v8,07/12] xhci: Add option to get next extended capability in list by passing id = 0 Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 07/12] " Heikki Krogerus
2018-03-14 13:12 [v8,06/12] usb: typec: tcpm: Use new Type-C switch/mux and usb-role-switch functions Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 06/12] " Heikki Krogerus
2018-03-14 13:12 [v8,05/12] usb: typec: tcpm: Set USB role switch to device mode when configured as such Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 05/12] " Heikki Krogerus
2018-03-14 13:12 [v8,04/12] usb: typec: Separate the definitions for data and power roles Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 04/12] " Heikki Krogerus
2018-03-14 13:12 [v8,03/12] usb: common: Small class for USB role switches Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 03/12] " Heikki Krogerus
2018-03-14 13:12 [v8,02/12] usb: typec: API for controlling USB Type-C Multiplexers Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 02/12] " Heikki Krogerus
2018-03-14 13:12 [v8,01/12] drivers: base: Unified device connection lookup Heikki Krogerus
2018-03-14 13:12 ` [PATCH v8 01/12] " Heikki Krogerus
2018-03-14 13:12 [PATCH v8 00/12] USB Type-C device-connection, mux and switch support Heikki Krogerus

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=20180320100412.GI11689@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andy@infradead.org \
    --cc=cw00.choi@samsung.com \
    --cc=dvhart@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=jun.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mathias.nyman@intel.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=platform-driver-x86@vger.kernel.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.