[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3884a134-c916-7b30-1db3-1e2c8f0d9d5b@suse.de>
Date: Thu, 9 Aug 2018 22:43:42 +0200
From: Andreas Färber <afaerber@...e.de>
To: Ben Whitten <ben.whitten@...il.com>
Cc: starnight@...cu.edu.tw, hasnain.virk@....com,
netdev@...r.kernel.org, liuxuenetmail@...il.com, shess@...sware.de,
Ben Whitten <ben.whitten@...rdtech.com>
Subject: Re: [PATCH lora-next v2 3/8] net: lora: sx1301: convert to passing
priv data throughout
Am 09.08.2018 um 14:33 schrieb Ben Whitten:
> Instead of passing around the spi device we instead pass around our
> driver data directly.
>
> Signed-off-by: Ben Whitten <ben.whitten@...rdtech.com>
> ---
> drivers/net/lora/sx1301.c | 305 +++++++++++++++++++++++-----------------------
> 1 file changed, 155 insertions(+), 150 deletions(-)
>
> diff --git a/drivers/net/lora/sx1301.c b/drivers/net/lora/sx1301.c
> index 3c09f5a..7324001 100644
> --- a/drivers/net/lora/sx1301.c
> +++ b/drivers/net/lora/sx1301.c
> @@ -73,24 +73,26 @@ struct spi_sx1301 {
> };
>
> struct sx1301_priv {
> + struct device *dev;
> + struct spi_device *spi;
Obviously this is not a long-term solution, but as interim step it'll
have to do.
> struct lora_priv lora;
> struct gpio_desc *rst_gpio;
> u8 cur_page;
> struct spi_controller *radio_a_ctrl, *radio_b_ctrl;
> };
>
> -static int sx1301_read_burst(struct spi_device *spi, u8 reg, u8 *val, size_t len)
> +static int sx1301_read_burst(struct sx1301_priv *priv, u8 reg, u8 *val, size_t len)
> {
> u8 addr = reg & 0x7f;
> - return spi_write_then_read(spi, &addr, 1, val, len);
> + return spi_write_then_read(priv->spi, &addr, 1, val, len);
> }
>
> -static int sx1301_read(struct spi_device *spi, u8 reg, u8 *val)
> +static int sx1301_read(struct sx1301_priv *priv, u8 reg, u8 *val)
> {
> - return sx1301_read_burst(spi, reg, val, 1);
> + return sx1301_read_burst(priv, reg, val, 1);
> }
>
> -static int sx1301_write_burst(struct spi_device *spi, u8 reg, const u8 *val, size_t len)
> +static int sx1301_write_burst(struct sx1301_priv *priv, u8 reg, const u8 *val, size_t len)
> {
> u8 addr = reg | BIT(7);
> struct spi_transfer xfr[2] = {
This hunk did not apply for some reason, I've manually re-applied it.
[...]
> @@ -654,22 +646,35 @@ static int sx1301_probe(struct spi_device *spi)
> priv->rst_gpio = rst;
> priv->cur_page = 0xff;
>
> - spi_set_drvdata(spi, netdev);
> + spi_set_drvdata(spi, priv);
This change seems unnecessary and counter-productive for unregistration.
Otherwise applying.
Thanks,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Powered by blists - more mailing lists