Re: [PATCH] staging: rts5208 : Fixing coding style warnings

From: Frans Klaver
Date: Wed Jun 28 2017 - 08:58:53 EST


Hi,

On Wed, Jun 28, 2017 at 2:50 PM, Simo Koskinen <koskisoft@xxxxxxxxx> wrote:
> Fixed following warnings found by checkpatch.pl script:
>
> WARNING: Prefer using '"%s...", __func__' to using 'xxxx',
> this function's name, in a string
>
> Signed-off-by: Simo Koskinen <koskisoft@xxxxxxxxx>
> ---
> drivers/staging/rts5208/rtsx.c | 2 --
> drivers/staging/rts5208/rtsx_chip.c | 4 ++--
> drivers/staging/rts5208/sd.c | 8 ++++----
> drivers/staging/rts5208/spi.c | 8 ++++----
> drivers/staging/rts5208/xd.c | 11 ++++++-----
> 5 files changed, 16 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
> index b8177f5..c7ae702 100644
> --- a/drivers/staging/rts5208/rtsx.c
> +++ b/drivers/staging/rts5208/rtsx.c
> @@ -1009,8 +1009,6 @@ static void rtsx_remove(struct pci_dev *pci)
> {
> struct rtsx_dev *dev = pci_get_drvdata(pci);
>
> - dev_info(&pci->dev, "rtsx_remove() called\n");
> -
> quiesce_and_remove_host(dev);
> release_everything(dev);
> }
> diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c
> index 7f4107b..4ad472d 100644
> --- a/drivers/staging/rts5208/rtsx_chip.c
> +++ b/drivers/staging/rts5208/rtsx_chip.c
> @@ -616,8 +616,8 @@ int rtsx_reset_chip(struct rtsx_chip *chip)
> else
> retval = rtsx_pre_handle_sdio_new(chip);
>
> - dev_dbg(rtsx_dev(chip), "chip->need_reset = 0x%x (rtsx_reset_chip)\n",
> - (unsigned int)(chip->need_reset));
> + dev_dbg(rtsx_dev(chip), "chip->need_reset = 0x%x (%s)\n",
> + (unsigned int)(chip->need_reset), __func__);
> #else /* HW_AUTO_SWITCH_SD_BUS */
> retval = rtsx_pre_handle_sdio_old(chip);
> #endif /* HW_AUTO_SWITCH_SD_BUS */
> diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
> index c2eb072..ae774ff 100644
> --- a/drivers/staging/rts5208/sd.c
> +++ b/drivers/staging/rts5208/sd.c
> @@ -910,8 +910,8 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir)
> int retval;
> bool ddr_rx = false;
>
> - dev_dbg(rtsx_dev(chip), "sd_change_phase (sample_point = %d, tune_dir = %d)\n",
> - sample_point, tune_dir);
> + dev_dbg(rtsx_dev(chip), "%s (sample_point = %d, tune_dir = %d)\n",
> + __func__, sample_point, tune_dir);
>
> if (tune_dir == TUNE_RX) {
> SD_VP_CTL = SD_VPRX_CTL;
> @@ -3575,8 +3575,8 @@ static int reset_mmc_only(struct rtsx_chip *chip)
> return STATUS_FAIL;
> }
>
> - dev_dbg(rtsx_dev(chip), "In reset_mmc_only, sd_card->sd_type = 0x%x\n",
> - sd_card->sd_type);
> + dev_dbg(rtsx_dev(chip), "In %s, sd_card->sd_type = 0x%x\n",
> + __func__, sd_card->sd_type);
>
> return STATUS_SUCCESS;
> }
> diff --git a/drivers/staging/rts5208/spi.c b/drivers/staging/rts5208/spi.c
> index 8b8cd95..feb9c2b 100644
> --- a/drivers/staging/rts5208/spi.c
> +++ b/drivers/staging/rts5208/spi.c
> @@ -520,8 +520,8 @@ int spi_get_status(struct scsi_cmnd *srb, struct rtsx_chip *chip)
> {
> struct spi_info *spi = &chip->spi;
>
> - dev_dbg(rtsx_dev(chip), "spi_get_status: err_code = 0x%x\n",
> - spi->err_code);
> + dev_dbg(rtsx_dev(chip), "%s: err_code = 0x%x\n",
> + __func__, spi->err_code);
> rtsx_stor_set_xfer_buf(&spi->err_code,
> min_t(int, scsi_bufflen(srb), 1), srb);
> scsi_set_resid(srb, scsi_bufflen(srb) - 1);
> @@ -543,8 +543,8 @@ int spi_set_parameter(struct scsi_cmnd *srb, struct rtsx_chip *chip)
> spi->clk_div = ((u16)(srb->cmnd[4]) << 8) | srb->cmnd[5];
> spi->write_en = srb->cmnd[6];
>
> - dev_dbg(rtsx_dev(chip), "spi_set_parameter: spi_clock = %d, clk_div = %d, write_en = %d\n",
> - spi->spi_clock, spi->clk_div, spi->write_en);
> + dev_dbg(rtsx_dev(chip), "%s: spi_clock = %d, clk_div = %d, write_en = %d\n",
> + __func__, spi->spi_clock, spi->clk_div, spi->write_en);
>
> return STATUS_SUCCESS;
> }
> diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
> index 74d36f9..dc0baf0 100644
> --- a/drivers/staging/rts5208/xd.c
> +++ b/drivers/staging/rts5208/xd.c
> @@ -885,8 +885,8 @@ static int xd_init_l2p_tbl(struct rtsx_chip *chip)
> struct xd_info *xd_card = &chip->xd_card;
> int size, i;
>
> - dev_dbg(rtsx_dev(chip), "xd_init_l2p_tbl: zone_cnt = %d\n",
> - xd_card->zone_cnt);
> + dev_dbg(rtsx_dev(chip), "%s: zone_cnt = %d\n",
> + __func__, xd_card->zone_cnt);
>
> if (xd_card->zone_cnt < 1) {
> rtsx_trace(chip);
> @@ -1026,7 +1026,8 @@ static u32 xd_get_l2p_tbl(struct rtsx_chip *chip, int zone_no, u16 log_off)
> #ifdef XD_DELAY_WRITE
> retval = xd_delay_write(chip);
> if (retval != STATUS_SUCCESS) {
> - dev_dbg(rtsx_dev(chip), "In xd_get_l2p_tbl, delay write fail!\n");
> + dev_dbg(rtsx_dev(chip), "In %s, delay write fail!\n",
> + __func__);
> return BLK_NOT_FOUND;
> }
> #endif
> @@ -1434,7 +1435,7 @@ static int xd_build_l2p_tbl(struct rtsx_chip *chip, int zone_no)
> u16 cur_lst_page_logoff, ent_lst_page_logoff;
> u8 redunt[11];
>
> - dev_dbg(rtsx_dev(chip), "xd_build_l2p_tbl: %d\n", zone_no);
> + dev_dbg(rtsx_dev(chip), "%s: %d\n", __func__, zone_no);
>
> if (!xd_card->zone) {
> retval = xd_init_l2p_tbl(chip);
> @@ -1960,7 +1961,7 @@ int xd_delay_write(struct rtsx_chip *chip)
> int retval;
>
> if (delay_write->delay_write_flag) {
> - dev_dbg(rtsx_dev(chip), "xd_delay_write\n");
> + dev_dbg(rtsx_dev(chip), "%s\n", __func__);
> retval = xd_switch_clock(chip);
> if (retval != STATUS_SUCCESS) {
> rtsx_trace(chip);
> --
> 2.7.4
>

You should include a version number in your subject line when posting
a new version of your patch:

[PATCH v2] staging: rts5208: use __func__ rather than function name

Now in this case you could even split up the patch, because you're
doing two things:

1. remove some pointless debug lines
2. replace hardcoded function names with __func__