aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-12-02 04:27:06 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-02 15:17:50 -0500
commit8efa5d7d6ad307ae2d220def37ca89594062c40d (patch)
treec56eac029c47751932a9b7c5a1432b53fbae3361
parent4aa5d783c9e1c72e4950ff34f388077ccecac74a (diff)
ath5k: Check if pci pdev struct is initialized in common functions.
To be able to support other busses than PCI check if pci device structure is initialized. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath5k/attach.c5
-rw-r--r--drivers/net/wireless/ath/ath5k/led.c5
-rw-r--r--drivers/net/wireless/ath/ath5k/reset.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/sysfs.c4
4 files changed, 10 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index a84782a63e0a..86f6fec069e8 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -273,7 +273,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
273 /* 273 /*
274 * Write PCI-E power save settings 274 * Write PCI-E power save settings
275 */ 275 */
276 if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { 276 if ((ah->ah_version == AR5K_AR5212) && pdev && (pdev->is_pcie)) {
277 ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES); 277 ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES);
278 ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES); 278 ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES);
279 279
@@ -305,8 +305,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
305 /* Get misc capabilities */ 305 /* Get misc capabilities */
306 ret = ath5k_hw_set_capabilities(ah); 306 ret = ath5k_hw_set_capabilities(ah);
307 if (ret) { 307 if (ret) {
308 ATH5K_ERR(sc, "unable to get device capabilities: 0x%04x\n", 308 ATH5K_ERR(sc, "unable to get device capabilities\n");
309 sc->pdev->device);
310 goto err; 309 goto err;
311 } 310 }
312 311
diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c
index 67aa52e9bf94..1f5a991aa0a9 100644
--- a/drivers/net/wireless/ath/ath5k/led.c
+++ b/drivers/net/wireless/ath/ath5k/led.c
@@ -133,7 +133,7 @@ ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led,
133 led->led_dev.default_trigger = trigger; 133 led->led_dev.default_trigger = trigger;
134 led->led_dev.brightness_set = ath5k_led_brightness_set; 134 led->led_dev.brightness_set = ath5k_led_brightness_set;
135 135
136 err = led_classdev_register(&sc->pdev->dev, &led->led_dev); 136 err = led_classdev_register(sc->dev, &led->led_dev);
137 if (err) { 137 if (err) {
138 ATH5K_WARN(sc, "could not register LED %s\n", name); 138 ATH5K_WARN(sc, "could not register LED %s\n", name);
139 led->sc = NULL; 139 led->sc = NULL;
@@ -165,6 +165,9 @@ int ath5k_init_leds(struct ath5k_softc *sc)
165 char name[ATH5K_LED_MAX_NAME_LEN + 1]; 165 char name[ATH5K_LED_MAX_NAME_LEN + 1];
166 const struct pci_device_id *match; 166 const struct pci_device_id *match;
167 167
168 if (!sc->pdev)
169 return 0;
170
168 match = pci_match_id(&ath5k_led_devices[0], pdev); 171 match = pci_match_id(&ath5k_led_devices[0], pdev);
169 if (match) { 172 if (match) {
170 __set_bit(ATH_STAT_LEDSOFT, sc->status); 173 __set_bit(ATH_STAT_LEDSOFT, sc->status);
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index 7d8ef8decf00..f2f889d0cf59 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -471,7 +471,7 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah)
471 * we ingore that flag for PCI-E cards. On PCI cards 471 * we ingore that flag for PCI-E cards. On PCI cards
472 * this flag gets cleared after 64 PCI clocks. 472 * this flag gets cleared after 64 PCI clocks.
473 */ 473 */
474 bus_flags = (pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; 474 bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI;
475 475
476 if (ah->ah_version == AR5K_AR5210) { 476 if (ah->ah_version == AR5K_AR5210) {
477 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | 477 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU |
@@ -526,7 +526,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
526 * we ingore that flag for PCI-E cards. On PCI cards 526 * we ingore that flag for PCI-E cards. On PCI cards
527 * this flag gets cleared after 64 PCI clocks. 527 * this flag gets cleared after 64 PCI clocks.
528 */ 528 */
529 bus_flags = (pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; 529 bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI;
530 530
531 if (ah->ah_version == AR5K_AR5210) { 531 if (ah->ah_version == AR5K_AR5210) {
532 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | 532 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU |
diff --git a/drivers/net/wireless/ath/ath5k/sysfs.c b/drivers/net/wireless/ath/ath5k/sysfs.c
index 90757de7bf59..929c68cdf8ab 100644
--- a/drivers/net/wireless/ath/ath5k/sysfs.c
+++ b/drivers/net/wireless/ath/ath5k/sysfs.c
@@ -95,7 +95,7 @@ static struct attribute_group ath5k_attribute_group_ani = {
95int 95int
96ath5k_sysfs_register(struct ath5k_softc *sc) 96ath5k_sysfs_register(struct ath5k_softc *sc)
97{ 97{
98 struct device *dev = &sc->pdev->dev; 98 struct device *dev = sc->dev;
99 int err; 99 int err;
100 100
101 err = sysfs_create_group(&dev->kobj, &ath5k_attribute_group_ani); 101 err = sysfs_create_group(&dev->kobj, &ath5k_attribute_group_ani);
@@ -110,7 +110,7 @@ ath5k_sysfs_register(struct ath5k_softc *sc)
110void 110void
111ath5k_sysfs_unregister(struct ath5k_softc *sc) 111ath5k_sysfs_unregister(struct ath5k_softc *sc)
112{ 112{
113 struct device *dev = &sc->pdev->dev; 113 struct device *dev = sc->dev;
114 114
115 sysfs_remove_group(&dev->kobj, &ath5k_attribute_group_ani); 115 sysfs_remove_group(&dev->kobj, &ath5k_attribute_group_ani);
116} 116}