All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <linux-i2c@vger.kernel.org>, Wolfram Sang <wsa@kernel.org>,
	Niyas Sait <niyas.sait@linaro.org>,
	Klaus Jensen <its@irrelevant.dk>,
	Andy Shevchenko <andy@kernel.org>, <linux-acpi@vger.kernel.org>,
	Jeremy Kerr <jk@codeconstruct.com.au>,
	Matt Johnston <matt@codeconstruct.com.au>,
	Shesha Bhushan Sreenivasamurthy <sheshas@marvell.com>,
	<linux-cxl@vger.kernel.org>, <linuxarm@huawei.com>,
	"Viacheslav A . Dubeyko" <viacheslav.dubeyko@bytedance.com>
Subject: Re: [RFC PATCH v3 4/7] i2c: aspeed: use a function pointer type def for clk_reg_val callback
Date: Thu, 1 Jun 2023 10:07:10 +0100	[thread overview]
Message-ID: <20230601100710.00000456@Huawei.com> (raw)
In-Reply-To: <CAHp75Ve2mpPPoRG6SQ3nT1uE-y35+-sMDMPQSu97i9_5SDCYZQ@mail.gmail.com>

On Wed, 31 May 2023 20:42:15 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Wed, May 31, 2023 at 1:08 PM Jonathan Cameron
> <Jonathan.Cameron@huawei.com> wrote:
> >
> > Rather than having to define the parameter types of this function
> > in multiple places, use a single typedef.  
> 
> Suggested-by then?
> 
Good point.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Hopefully Wolfram uses b4 and that will get picked up automatically.

> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > ---
> > v3: New patch to switch to a function pointer as suggested by Andy.
> > ---
> >  drivers/i2c/busses/i2c-aspeed.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
> > index 4363bfe06f9b..be93de56f7e4 100644
> > --- a/drivers/i2c/busses/i2c-aspeed.c
> > +++ b/drivers/i2c/busses/i2c-aspeed.c
> > @@ -137,6 +137,8 @@ enum aspeed_i2c_slave_state {
> >         ASPEED_I2C_SLAVE_STOP,
> >  };
> >
> > +typedef u32 (*aspeed_get_clk_reg_val_cb)(struct device *dev, u32 divisor);
> > +
> >  struct aspeed_i2c_bus {
> >         struct i2c_adapter              adap;
> >         struct device                   *dev;
> > @@ -145,8 +147,7 @@ struct aspeed_i2c_bus {
> >         /* Synchronizes I/O mem access to base. */
> >         spinlock_t                      lock;
> >         struct completion               cmd_complete;
> > -       u32                             (*get_clk_reg_val)(struct device *dev,
> > -                                                          u32 divisor);
> > +       aspeed_get_clk_reg_val_cb       get_clk_reg_val;
> >         unsigned long                   parent_clk_frequency;
> >         u32                             bus_frequency;
> >         /* Transaction state. */
> > @@ -1011,8 +1012,7 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
> >         if (!match)
> >                 bus->get_clk_reg_val = aspeed_i2c_24xx_get_clk_reg_val;
> >         else
> > -               bus->get_clk_reg_val = (u32 (*)(struct device *, u32))
> > -                               match->data;
> > +               bus->get_clk_reg_val = (aspeed_get_clk_reg_val_cb)(match->data);
> >
> >         /* Initialize the I2C adapter */
> >         spin_lock_init(&bus->lock);
> > --
> > 2.39.2
> >  
> 
> 


  reply	other threads:[~2023-06-01  9:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 10:05 [RFC PATCH v3 0/7] i2c: Enabling use of aspeed-i2c with ACPI Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 1/7] i2c: acpi: set slave mode flag Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 2/7] i2c: aspeed: Use platform_get_irq() instead of opencoding Jonathan Cameron
2023-05-31 17:41   ` Andy Shevchenko
2023-05-31 10:05 ` [RFC PATCH v3 3/7] i2c: aspeed: Don't report error when optional dt bus-frequency not supplied Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 4/7] i2c: aspeed: use a function pointer type def for clk_reg_val callback Jonathan Cameron
2023-05-31 17:42   ` Andy Shevchenko
2023-06-01  9:07     ` Jonathan Cameron [this message]
2023-05-31 10:05 ` [RFC PATCH v3 5/7] i2c: aspeed: switch to generic fw properties Jonathan Cameron
2023-05-31 17:45   ` Andy Shevchenko
2023-06-01  9:08     ` Jonathan Cameron
2023-05-31 10:05 ` [RFC PATCH v3 6/7] i2c: aspeed: Set the fwnode for the adap->dev Jonathan Cameron
2023-05-31 17:46   ` Andy Shevchenko
2023-06-01  9:10     ` Jonathan Cameron
2023-05-31 10:06 ` [RFC PATCH v3 7/7] HACK: i2c: aspeed: Comment clock out and make reset optional Jonathan Cameron

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=20230601100710.00000456@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=its@irrelevant.dk \
    --cc=jk@codeconstruct.com.au \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=matt@codeconstruct.com.au \
    --cc=niyas.sait@linaro.org \
    --cc=sheshas@marvell.com \
    --cc=viacheslav.dubeyko@bytedance.com \
    --cc=wsa@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.