Re: [PATCH] atheros/atlx: Simplify bit manipulations

From: Francois Romieu
Date: Fri Jan 23 2015 - 15:26:28 EST


Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> :
[...]
> diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
> index 84a09e8ddd9c..46d1b959daa8 100644
> --- a/drivers/net/ethernet/atheros/atlx/atl2.c
> +++ b/drivers/net/ethernet/atheros/atlx/atl2.c
> @@ -1278,14 +1278,10 @@ static void atl2_setup_pcicmd(struct pci_dev *pdev)
>
> pci_read_config_word(pdev, PCI_COMMAND, &cmd);
>
> - if (cmd & PCI_COMMAND_INTX_DISABLE)
> - cmd &= ~PCI_COMMAND_INTX_DISABLE;
> - if (cmd & PCI_COMMAND_IO)
> - cmd &= ~PCI_COMMAND_IO;
> - if (0 == (cmd & PCI_COMMAND_MEMORY))
> - cmd |= PCI_COMMAND_MEMORY;
> - if (0 == (cmd & PCI_COMMAND_MASTER))
> - cmd |= PCI_COMMAND_MASTER;
> + cmd &= ~PCI_COMMAND_INTX_DISABLE;
> + cmd &= ~PCI_COMMAND_IO;
> + cmd |= PCI_COMMAND_MEMORY;
> + cmd |= PCI_COMMAND_MASTER;
> pci_write_config_word(pdev, PCI_COMMAND, cmd);

Mostly open-coded pci_set_master, pci_enable_device_mem and pci_intx.

I'd suggest to ignore the PCI_COMMAND_IO bit at all then use the standard
pci helpers.

--
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/