mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-21 21:38:04 -04:00
misc: pch_phub: Introduce an enum for device indentification
Instead of using magic constants give them names that make the code more idiomatic. While touching the pci_device_id array, use named initializers to assign .driver_data. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/62223b743982616b1085c03f67ff88a2412d3da1.1779360001.git.u.kleine-koenig@baylibre.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d14b649fd9
commit
7b1d4ad96e
@@ -537,6 +537,14 @@ static const struct bin_attribute pch_bin_attr = {
|
||||
.write = pch_phub_bin_write,
|
||||
};
|
||||
|
||||
enum {
|
||||
PCH_EG20T,
|
||||
PCH_ML7213,
|
||||
PCH_ML7223M,
|
||||
PCH_ML7223N,
|
||||
PCH_ML7831,
|
||||
};
|
||||
|
||||
static int pch_phub_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *id)
|
||||
{
|
||||
@@ -579,7 +587,7 @@ static int pch_phub_probe(struct pci_dev *pdev,
|
||||
|
||||
chip->pdev = pdev; /* Save pci device struct */
|
||||
|
||||
if (id->driver_data == 1) { /* EG20T PCH */
|
||||
if (id->driver_data == PCH_EG20T) { /* EG20T PCH */
|
||||
const char *board_name;
|
||||
unsigned int prefetch = 0x000affaa;
|
||||
|
||||
@@ -627,7 +635,7 @@ static int pch_phub_probe(struct pci_dev *pdev,
|
||||
CLKCFG_UART_MASK);
|
||||
}
|
||||
}
|
||||
} else if (id->driver_data == 2) { /* ML7213 IOH */
|
||||
} else if (id->driver_data == PCH_ML7213) { /* ML7213 IOH */
|
||||
ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
|
||||
if (ret)
|
||||
goto err_sysfs_create;
|
||||
@@ -640,7 +648,7 @@ static int pch_phub_probe(struct pci_dev *pdev,
|
||||
iowrite32(0x000affa0, chip->pch_phub_base_address + 0x14);
|
||||
chip->pch_opt_rom_start_address =\
|
||||
PCH_PHUB_ROM_START_ADDR_ML7213;
|
||||
} else if (id->driver_data == 3) { /* ML7223 IOH Bus-m*/
|
||||
} else if (id->driver_data == PCH_ML7223M) { /* ML7223 IOH Bus-m*/
|
||||
/* set the prefech value
|
||||
* Device8(GbE)
|
||||
*/
|
||||
@@ -650,7 +658,7 @@ static int pch_phub_probe(struct pci_dev *pdev,
|
||||
chip->pch_opt_rom_start_address =\
|
||||
PCH_PHUB_ROM_START_ADDR_ML7223;
|
||||
chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
|
||||
} else if (id->driver_data == 4) { /* ML7223 IOH Bus-n*/
|
||||
} else if (id->driver_data == PCH_ML7223N) { /* ML7223 IOH Bus-n*/
|
||||
ret = sysfs_create_file(&pdev->dev.kobj,
|
||||
&dev_attr_pch_mac.attr);
|
||||
if (ret)
|
||||
@@ -667,7 +675,7 @@ static int pch_phub_probe(struct pci_dev *pdev,
|
||||
chip->pch_opt_rom_start_address =\
|
||||
PCH_PHUB_ROM_START_ADDR_ML7223;
|
||||
chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
|
||||
} else if (id->driver_data == 5) { /* ML7831 */
|
||||
} else if (id->driver_data == PCH_ML7831) { /* ML7831 */
|
||||
ret = sysfs_create_file(&pdev->dev.kobj,
|
||||
&dev_attr_pch_mac.attr);
|
||||
if (ret)
|
||||
@@ -731,11 +739,11 @@ static int __maybe_unused pch_phub_resume(struct device *dev_d)
|
||||
}
|
||||
|
||||
static const struct pci_device_id pch_phub_pcidev_id[] = {
|
||||
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH1_PHUB), 1, },
|
||||
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), 2, },
|
||||
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_mPHUB), 3, },
|
||||
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_nPHUB), 4, },
|
||||
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7831_PHUB), 5, },
|
||||
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH1_PHUB), .driver_data = PCH_EG20T },
|
||||
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), .driver_data = PCH_ML7213 },
|
||||
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_mPHUB), .driver_data = PCH_ML7223M },
|
||||
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_nPHUB), .driver_data = PCH_ML7223N },
|
||||
{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7831_PHUB), .driver_data = PCH_ML7831 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id);
|
||||
|
||||
Reference in New Issue
Block a user