[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58266185-3a87-3a88-d10c-52631e26e17d@suse.de>
Date: Thu, 9 Aug 2018 23:11:16 +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 6/8] net: lora: sx1301: replace version and
size magic numbers with defines
Am 09.08.2018 um 14:33 schrieb Ben Whitten:
> We replace the hard coded numbers for size and version with meaningful
> names.
>
> Signed-off-by: Ben Whitten <ben.whitten@...rdtech.com>
> ---
> drivers/net/lora/sx1301.c | 21 +++++++++++++--------
> drivers/net/lora/sx1301.h | 18 ++++++++++++++++++
> 2 files changed, 31 insertions(+), 8 deletions(-)
> create mode 100644 drivers/net/lora/sx1301.h
>
> diff --git a/drivers/net/lora/sx1301.c b/drivers/net/lora/sx1301.c
> index 916ee40..8e81179 100644
> --- a/drivers/net/lora/sx1301.c
> +++ b/drivers/net/lora/sx1301.c
> @@ -21,6 +21,8 @@
> #include <linux/lora/dev.h>
> #include <linux/spi/spi.h>
>
> +#include "sx1301.h"
> +
> #define REG_PAGE_RESET 0
> #define REG_VERSION 1
> #define REG_MCU_PROM_ADDR 9
> @@ -293,7 +295,7 @@ static int sx1301_load_firmware(struct sx1301_priv *priv, int mcu, const struct
> u8 val, rst, select_mux;
> int ret;
>
> - if (fw->size != 8192) {
> + if (fw->size != SX1301_MCU_FW_BYTE) {
I think that should be BYTES, but we can still rename it later.
> dev_err(priv->dev, "Unexpected firmware size\n");
> return -EINVAL;
> }
[...]
> diff --git a/drivers/net/lora/sx1301.h b/drivers/net/lora/sx1301.h
> new file mode 100644
> index 0000000..b37ac56
> --- /dev/null
> +++ b/drivers/net/lora/sx1301.h
> @@ -0,0 +1,18 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
Header files must use /* ... */ or checkpatch.pl complains.
> +/*
> + * Semtech SX1301 lora concentrator
LoRa
> + *
> + * Copyright (c) 2018 Ben Whitten
Any reason for the multiple whitespaces?
> + */
> +
> +#ifndef _SX1301_
> +#define _SX1301_
> +
> +#define SX1301_CHIP_VERSION 103
> +
> +#define SX1301_MCU_FW_BYTE 8192
> +#define SX1301_MCU_ARB_FW_VERSION 1
> +#define SX1301_MCU_AGC_FW_VERSION 4
> +#define SX1301_MCU_AGC_CAL_FW_VERSION 2
> +
> +#endif
Applied.
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