From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Sergey Shtylyov <s.shtylyov@omp.ru>, linux-ide@vger.kernel.org
Subject: Re: [PATCH v5 2/2] ata: pata_artop: use *switch* in atp8xx_fixup()
Date: Thu, 10 Feb 2022 08:29:27 +0900 [thread overview]
Message-ID: <a7d2fd87-9210-a960-b69e-dd0ea94e86d4@opensource.wdc.com> (raw)
In-Reply-To: <20220209202535.7679-3-s.shtylyov@omp.ru>
On 2/10/22 05:25, Sergey Shtylyov wrote:
> This driver uses a string of the *if* statements in atp8xx_fixup() where
> a *switch* statement would fit better...
>
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
>
> Changes in version 5:
> - fixed up #define DRV_VERSION;
> - added "ata: " prefix to the patch subject.
>
> Changes in version 4:
> - new patch.
>
> drivers/ata/pata_artop.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
> index 08e88403d0ab..20a8f31a3f57 100644
> --- a/drivers/ata/pata_artop.c
> +++ b/drivers/ata/pata_artop.c
> @@ -28,7 +28,7 @@
> #include <linux/ata.h>
>
> #define DRV_NAME "pata_artop"
> -#define DRV_VERSION "0.4.7"
> +#define DRV_VERSION "0.4.8"
>
> /*
> * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we
> @@ -315,12 +315,15 @@ static struct ata_port_operations artop6260_ops = {
>
> static void atp8xx_fixup(struct pci_dev *pdev)
> {
> - if (pdev->device == 0x0005)
> + u8 reg;
> +
> + switch (pdev->device) {
> + case 0x0005:
> /* BIOS may have left us in UDMA, clear it before libata probe */
> pci_write_config_byte(pdev, 0x54, 0);
> - else if (pdev->device == 0x0008 || pdev->device == 0x0009) {
> - u8 reg;
> -
> + break;
> + case 0x0008:
> + case 0x0009:
> /* Mac systems come up with some registers not set as we
> will need them */
>
> @@ -338,6 +341,7 @@ static void atp8xx_fixup(struct pci_dev *pdev)
> /* Enable IRQ output and burst mode */
> pci_read_config_byte(pdev, 0x4a, ®);
> pci_write_config_byte(pdev, 0x4a, (reg & ~0x01) | 0x80);
> + break;
> }
without a default case, isn't there a warning with make W=1 or make C=1
(sparse) ?
> }
>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2022-02-09 23:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 20:25 [PATCH v5 0/2] Use *switch*es instead of *if*s in the Artop PATA driver Sergey Shtylyov
2022-02-09 20:25 ` [PATCH v5 1/2] ata: pata_artop: use *switch* in artop_init_one() Sergey Shtylyov
2022-02-09 20:25 ` [PATCH v5 2/2] ata: pata_artop: use *switch* in atp8xx_fixup() Sergey Shtylyov
2022-02-09 23:29 ` Damien Le Moal [this message]
2022-02-09 23:34 ` Sergey Shtylyov
2022-02-10 3:07 ` [PATCH v5 0/2] Use *switch*es instead of *if*s in the Artop PATA driver Damien Le Moal
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=a7d2fd87-9210-a960-b69e-dd0ea94e86d4@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=linux-ide@vger.kernel.org \
--cc=s.shtylyov@omp.ru \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox