All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: hisi: Avoid generic function names
@ 2018-04-10 20:01 Ezequiel Garcia
  2018-04-10 20:58 ` Marek Vasut
  2018-04-22 17:20 ` Boris Brezillon
  0 siblings, 2 replies; 3+ messages in thread
From: Ezequiel Garcia @ 2018-04-10 20:01 UTC (permalink / raw)
  To: Cyrille Pitchen, Marek Vasut
  Cc: linux-mtd, Richard Weinberger, Brian Norris, boris.brezillon,
	Ezequiel Garcia

Using generic names such as get_if_type() is frowned
upon: it suggests a core function (which is not),
and then it makes code navigation harder.

Given drivers are often used as starting point
to write other drivers, generic names tend to spread
like the flu. Cure the problem.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/mtd/spi-nor/hisi-sfc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi-nor/hisi-sfc.c b/drivers/mtd/spi-nor/hisi-sfc.c
index 04f9fb5cd9b6..dea7b0c4b339 100644
--- a/drivers/mtd/spi-nor/hisi-sfc.c
+++ b/drivers/mtd/spi-nor/hisi-sfc.c
@@ -112,7 +112,7 @@ struct hifmc_host {
 	u32 num_chip;
 };
 
-static inline int wait_op_finish(struct hifmc_host *host)
+static inline int hisi_spi_nor_wait_op_finish(struct hifmc_host *host)
 {
 	u32 reg;
 
@@ -120,7 +120,7 @@ static inline int wait_op_finish(struct hifmc_host *host)
 		(reg & FMC_INT_OP_DONE), 0, FMC_WAIT_TIMEOUT);
 }
 
-static int get_if_type(enum spi_nor_protocol proto)
+static int hisi_spi_nor_get_if_type(enum spi_nor_protocol proto)
 {
 	enum hifmc_iftype if_type;
 
@@ -208,7 +208,7 @@ static int hisi_spi_nor_op_reg(struct spi_nor *nor,
 	reg = FMC_OP_CMD1_EN | FMC_OP_REG_OP_START | optype;
 	writel(reg, host->regbase + FMC_OP);
 
-	return wait_op_finish(host);
+	return hisi_spi_nor_wait_op_finish(host);
 }
 
 static int hisi_spi_nor_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf,
@@ -259,9 +259,9 @@ static int hisi_spi_nor_dma_transfer(struct spi_nor *nor, loff_t start_off,
 
 	reg = OP_CFG_FM_CS(priv->chipselect);
 	if (op_type == FMC_OP_READ)
-		if_type = get_if_type(nor->read_proto);
+		if_type = hisi_spi_nor_get_if_type(nor->read_proto);
 	else
-		if_type = get_if_type(nor->write_proto);
+		if_type = hisi_spi_nor_get_if_type(nor->write_proto);
 	reg |= OP_CFG_MEM_IF_TYPE(if_type);
 	if (op_type == FMC_OP_READ)
 		reg |= OP_CFG_DUMMY_NUM(nor->read_dummy >> 3);
@@ -274,7 +274,7 @@ static int hisi_spi_nor_dma_transfer(struct spi_nor *nor, loff_t start_off,
 		: OP_CTRL_WR_OPCODE(nor->program_opcode);
 	writel(reg, host->regbase + FMC_OP_DMA);
 
-	return wait_op_finish(host);
+	return hisi_spi_nor_wait_op_finish(host);
 }
 
 static ssize_t hisi_spi_nor_read(struct spi_nor *nor, loff_t from, size_t len,
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: spi-nor: hisi: Avoid generic function names
  2018-04-10 20:01 [PATCH] mtd: spi-nor: hisi: Avoid generic function names Ezequiel Garcia
@ 2018-04-10 20:58 ` Marek Vasut
  2018-04-22 17:20 ` Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2018-04-10 20:58 UTC (permalink / raw)
  To: Ezequiel Garcia, Cyrille Pitchen
  Cc: linux-mtd, Richard Weinberger, Brian Norris, boris.brezillon

On 04/10/2018 10:01 PM, Ezequiel Garcia wrote:
> Using generic names such as get_if_type() is frowned
> upon: it suggests a core function (which is not),
> and then it makes code navigation harder.
> 
> Given drivers are often used as starting point
> to write other drivers, generic names tend to spread
> like the flu. Cure the problem.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>

Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: spi-nor: hisi: Avoid generic function names
  2018-04-10 20:01 [PATCH] mtd: spi-nor: hisi: Avoid generic function names Ezequiel Garcia
  2018-04-10 20:58 ` Marek Vasut
@ 2018-04-22 17:20 ` Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-04-22 17:20 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Cyrille Pitchen, Marek Vasut, linux-mtd, Richard Weinberger,
	Brian Norris

On Tue, 10 Apr 2018 17:01:06 -0300
Ezequiel Garcia <ezequiel@collabora.com> wrote:

> Using generic names such as get_if_type() is frowned
> upon: it suggests a core function (which is not),
> and then it makes code navigation harder.
> 
> Given drivers are often used as starting point
> to write other drivers, generic names tend to spread
> like the flu. Cure the problem.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>

Applied to spi-nor/next.

Thanks,

Boris

> ---
>  drivers/mtd/spi-nor/hisi-sfc.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/hisi-sfc.c b/drivers/mtd/spi-nor/hisi-sfc.c
> index 04f9fb5cd9b6..dea7b0c4b339 100644
> --- a/drivers/mtd/spi-nor/hisi-sfc.c
> +++ b/drivers/mtd/spi-nor/hisi-sfc.c
> @@ -112,7 +112,7 @@ struct hifmc_host {
>  	u32 num_chip;
>  };
>  
> -static inline int wait_op_finish(struct hifmc_host *host)
> +static inline int hisi_spi_nor_wait_op_finish(struct hifmc_host *host)
>  {
>  	u32 reg;
>  
> @@ -120,7 +120,7 @@ static inline int wait_op_finish(struct hifmc_host *host)
>  		(reg & FMC_INT_OP_DONE), 0, FMC_WAIT_TIMEOUT);
>  }
>  
> -static int get_if_type(enum spi_nor_protocol proto)
> +static int hisi_spi_nor_get_if_type(enum spi_nor_protocol proto)
>  {
>  	enum hifmc_iftype if_type;
>  
> @@ -208,7 +208,7 @@ static int hisi_spi_nor_op_reg(struct spi_nor *nor,
>  	reg = FMC_OP_CMD1_EN | FMC_OP_REG_OP_START | optype;
>  	writel(reg, host->regbase + FMC_OP);
>  
> -	return wait_op_finish(host);
> +	return hisi_spi_nor_wait_op_finish(host);
>  }
>  
>  static int hisi_spi_nor_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf,
> @@ -259,9 +259,9 @@ static int hisi_spi_nor_dma_transfer(struct spi_nor *nor, loff_t start_off,
>  
>  	reg = OP_CFG_FM_CS(priv->chipselect);
>  	if (op_type == FMC_OP_READ)
> -		if_type = get_if_type(nor->read_proto);
> +		if_type = hisi_spi_nor_get_if_type(nor->read_proto);
>  	else
> -		if_type = get_if_type(nor->write_proto);
> +		if_type = hisi_spi_nor_get_if_type(nor->write_proto);
>  	reg |= OP_CFG_MEM_IF_TYPE(if_type);
>  	if (op_type == FMC_OP_READ)
>  		reg |= OP_CFG_DUMMY_NUM(nor->read_dummy >> 3);
> @@ -274,7 +274,7 @@ static int hisi_spi_nor_dma_transfer(struct spi_nor *nor, loff_t start_off,
>  		: OP_CTRL_WR_OPCODE(nor->program_opcode);
>  	writel(reg, host->regbase + FMC_OP_DMA);
>  
> -	return wait_op_finish(host);
> +	return hisi_spi_nor_wait_op_finish(host);
>  }
>  
>  static ssize_t hisi_spi_nor_read(struct spi_nor *nor, loff_t from, size_t len,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-22 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10 20:01 [PATCH] mtd: spi-nor: hisi: Avoid generic function names Ezequiel Garcia
2018-04-10 20:58 ` Marek Vasut
2018-04-22 17:20 ` Boris Brezillon

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.