public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Max Staudt <max@enpas.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-i2c@vger.kernel.org,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH v1] i2c: icy: Don't use software node when it's an overkill
Date: Thu, 9 Apr 2020 15:16:33 +0300	[thread overview]
Message-ID: <20200409121633.GA1534509@kuha.fi.intel.com> (raw)
In-Reply-To: <20200409103735.GV3676135@smile.fi.intel.com>

On Thu, Apr 09, 2020 at 01:37:35PM +0300, Andy Shevchenko wrote:
> On Wed, Apr 08, 2020 at 11:24:20PM +0200, Max Staudt wrote:
> > Thank you, that looks much nicer indeed. I have also tested it on my Amiga just to be sure - it works.
> 
> Thank you.
> 
> > However, no signature yet because the call stack is giving me a headache:
> > 
> > icy_probe()
> >  -> i2c_new_scanned_device()
> >  -> i2c_new_client_device()
> >  -> device_add_properties()
> > 
> > And here we are in drivers/base/property.c looking at device_add_properties():
> > 
> >  * WARNING: The callers should not use this function if it is known that there
> >  * is no real firmware node associated with @dev! In that case the callers
> >  * should create a software node and assign it to @dev directly.
> > 
> > 
> > Why is this warning there? It flies right in the face of what we're trying to achieve here.
> > 
> > It was introduced in 2018 with commit caf35cd52242 .
> > 
> > 
> > So either the warning is superfluous, or i2c_new_client_device() should be creating a software fwnode, I guess?
> 
> No and no.
> 
> First one because the mechanism is added to have quirks, it must not replace
> the actual possibility to provide this via firmware (DT / ACPI).
> 
> Second one, because software node API should have (has?) the same warning.
> 
> +Cc Heikki.
> 
> Heikki, am I correct?

In this case it should be possible supply a handle to a software node
with the board info. That should then later replace the fwnode and
properties members once the existing code is converted:

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index f6b942150631..648ea384d480 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -409,8 +409,7 @@ struct i2c_board_info {
        const char      *dev_name;
        void            *platform_data;
        struct device_node *of_node;
-       struct fwnode_handle *fwnode;
-       const struct property_entry *properties;
+       const struct software_node *swnode
        const struct resource *resources;
        unsigned int    num_resources;
        int             irq;

I2C core would then need to take care of registering that swnode of
course.

thanks,

-- 
heikki

  reply	other threads:[~2020-04-09 12:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 16:52 [PATCH v1] i2c: icy: Don't use software node when it's an overkill Andy Shevchenko
2020-04-08 21:24 ` Max Staudt
2020-04-09 10:37   ` Andy Shevchenko
2020-04-09 12:16     ` Heikki Krogerus [this message]
2020-04-09 23:51       ` Max Staudt
2020-04-14 14:54         ` 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=20200409121633.GA1534509@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=max@enpas.org \
    --cc=wsa+renesas@sang-engineering.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