diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-07-11 04:18:48 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2011-07-21 10:30:07 -0400 |
commit | c1c81401de30448baf35ec2f689ad21faffb0536 (patch) | |
tree | 872aba1888985f591444fff76fce41193f37922e /drivers/net/wireless | |
parent | d593411084a56124aa9d80aafa15db8463b2d8f7 (diff) |
iwlagn: iwl_bus holds drv_data as void * instead of iwl_priv
The price to pay is the access to the log system. Therefore logs from bus layer
are sent by dev_printk instead of IWL_XXXX.
Rename bus->priv to bus->drv_data to make the separation even clearer.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-bus.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-pci.c | 37 |
5 files changed, 26 insertions, 27 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index aee62d0726ab..8afdeca2946a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -26,9 +26,6 @@ | |||
26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | |||
30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
31 | |||
32 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
33 | #include <linux/module.h> | 30 | #include <linux/module.h> |
34 | #include <linux/init.h> | 31 | #include <linux/init.h> |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index 78dccde88aaf..785987d570c6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -336,7 +336,4 @@ void iwl_testmode_cleanup(struct iwl_priv *priv) | |||
336 | } | 336 | } |
337 | #endif | 337 | #endif |
338 | 338 | ||
339 | int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg); | ||
340 | void __devexit iwl_remove(struct iwl_priv * priv); | ||
341 | |||
342 | #endif /* __iwl_agn_h__ */ | 339 | #endif /* __iwl_agn_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-bus.h b/drivers/net/wireless/iwlwifi/iwl-bus.h index fef62e6c2c88..f3ee1c0c004c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-bus.h +++ b/drivers/net/wireless/iwlwifi/iwl-bus.h | |||
@@ -67,10 +67,9 @@ struct iwl_bus; | |||
67 | 67 | ||
68 | /** | 68 | /** |
69 | * struct iwl_bus_ops - bus specific operations | 69 | * struct iwl_bus_ops - bus specific operations |
70 | |||
71 | * @get_pm_support: must returns true if the bus can go to sleep | 70 | * @get_pm_support: must returns true if the bus can go to sleep |
72 | * @apm_config: will be called during the config of the APM configuration | 71 | * @apm_config: will be called during the config of the APM configuration |
73 | * @set_drv_data: set the priv pointer to the bus layer | 72 | * @set_drv_data: set the drv_data pointer to the bus layer |
74 | * @get_hw_id: prints the hw_id in the provided buffer | 73 | * @get_hw_id: prints the hw_id in the provided buffer |
75 | * @write8: write a byte to register at offset ofs | 74 | * @write8: write a byte to register at offset ofs |
76 | * @write32: write a dword to register at offset ofs | 75 | * @write32: write a dword to register at offset ofs |
@@ -88,9 +87,7 @@ struct iwl_bus_ops { | |||
88 | 87 | ||
89 | struct iwl_bus { | 88 | struct iwl_bus { |
90 | /* Common data to all buses */ | 89 | /* Common data to all buses */ |
91 | 90 | void *drv_data; /* driver's context */ | |
92 | /*TODO: priv should be void * */ | ||
93 | struct iwl_priv *priv; /* driver's context */ | ||
94 | struct device *dev; | 91 | struct device *dev; |
95 | struct iwl_bus_ops *ops; | 92 | struct iwl_bus_ops *ops; |
96 | 93 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index a2cb1f59d9d5..c2d58dfb573c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -398,6 +398,9 @@ int iwl_suspend(struct iwl_priv *priv); | |||
398 | int iwl_resume(struct iwl_priv *priv); | 398 | int iwl_resume(struct iwl_priv *priv); |
399 | #endif /* !CONFIG_PM */ | 399 | #endif /* !CONFIG_PM */ |
400 | 400 | ||
401 | int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg); | ||
402 | void __devexit iwl_remove(struct iwl_priv * priv); | ||
403 | |||
401 | /***************************************************** | 404 | /***************************************************** |
402 | * Error Handling Debugging | 405 | * Error Handling Debugging |
403 | ******************************************************/ | 406 | ******************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index 66448895f7ba..0b815de9254e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c | |||
@@ -120,20 +120,20 @@ static void iwl_pci_apm_config(struct iwl_bus *bus) | |||
120 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == | 120 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == |
121 | PCI_CFG_LINK_CTRL_VAL_L1_EN) { | 121 | PCI_CFG_LINK_CTRL_VAL_L1_EN) { |
122 | /* L1-ASPM enabled; disable(!) L0S */ | 122 | /* L1-ASPM enabled; disable(!) L0S */ |
123 | iwl_set_bit(bus->priv, CSR_GIO_REG, | 123 | iwl_set_bit(bus->drv_data, CSR_GIO_REG, |
124 | CSR_GIO_REG_VAL_L0S_ENABLED); | 124 | CSR_GIO_REG_VAL_L0S_ENABLED); |
125 | IWL_DEBUG_POWER(bus->priv, "L1 Enabled; Disabling L0S\n"); | 125 | dev_printk(KERN_INFO, bus->dev, "L1 Enabled; Disabling L0S\n"); |
126 | } else { | 126 | } else { |
127 | /* L1-ASPM disabled; enable(!) L0S */ | 127 | /* L1-ASPM disabled; enable(!) L0S */ |
128 | iwl_clear_bit(bus->priv, CSR_GIO_REG, | 128 | iwl_clear_bit(bus->drv_data, CSR_GIO_REG, |
129 | CSR_GIO_REG_VAL_L0S_ENABLED); | 129 | CSR_GIO_REG_VAL_L0S_ENABLED); |
130 | IWL_DEBUG_POWER(bus->priv, "L1 Disabled; Enabling L0S\n"); | 130 | dev_printk(KERN_INFO, bus->dev, "L1 Disabled; Enabling L0S\n"); |
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data) | 134 | static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data) |
135 | { | 135 | { |
136 | bus->priv = drv_data; | 136 | bus->drv_data = drv_data; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], | 139 | static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[], |
@@ -377,7 +377,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
377 | 377 | ||
378 | bus = kzalloc(sizeof(*bus) + sizeof(*pci_bus), GFP_KERNEL); | 378 | bus = kzalloc(sizeof(*bus) + sizeof(*pci_bus), GFP_KERNEL); |
379 | if (!bus) { | 379 | if (!bus) { |
380 | pr_err("Couldn't allocate iwl_pci_bus"); | 380 | dev_printk(KERN_ERR, &pdev->dev, |
381 | "Couldn't allocate iwl_pci_bus"); | ||
381 | err = -ENOMEM; | 382 | err = -ENOMEM; |
382 | goto out_no_pci; | 383 | goto out_no_pci; |
383 | } | 384 | } |
@@ -407,29 +408,33 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
407 | DMA_BIT_MASK(32)); | 408 | DMA_BIT_MASK(32)); |
408 | /* both attempts failed: */ | 409 | /* both attempts failed: */ |
409 | if (err) { | 410 | if (err) { |
410 | pr_err("No suitable DMA available.\n"); | 411 | dev_printk(KERN_ERR, bus->dev, |
412 | "No suitable DMA available.\n"); | ||
411 | goto out_pci_disable_device; | 413 | goto out_pci_disable_device; |
412 | } | 414 | } |
413 | } | 415 | } |
414 | 416 | ||
415 | err = pci_request_regions(pdev, DRV_NAME); | 417 | err = pci_request_regions(pdev, DRV_NAME); |
416 | if (err) { | 418 | if (err) { |
417 | pr_err("pci_request_regions failed"); | 419 | dev_printk(KERN_ERR, bus->dev, "pci_request_regions failed"); |
418 | goto out_pci_disable_device; | 420 | goto out_pci_disable_device; |
419 | } | 421 | } |
420 | 422 | ||
421 | pci_bus->hw_base = pci_iomap(pdev, 0, 0); | 423 | pci_bus->hw_base = pci_iomap(pdev, 0, 0); |
422 | if (!pci_bus->hw_base) { | 424 | if (!pci_bus->hw_base) { |
423 | pr_err("pci_iomap failed"); | 425 | dev_printk(KERN_ERR, bus->dev, "pci_iomap failed"); |
424 | err = -ENODEV; | 426 | err = -ENODEV; |
425 | goto out_pci_release_regions; | 427 | goto out_pci_release_regions; |
426 | } | 428 | } |
427 | 429 | ||
428 | pr_info("pci_resource_len = 0x%08llx\n", | 430 | dev_printk(KERN_INFO, &pdev->dev, |
431 | "pci_resource_len = 0x%08llx\n", | ||
429 | (unsigned long long) pci_resource_len(pdev, 0)); | 432 | (unsigned long long) pci_resource_len(pdev, 0)); |
430 | pr_info("pci_resource_base = %p\n", pci_bus->hw_base); | 433 | dev_printk(KERN_INFO, &pdev->dev, |
434 | "pci_resource_base = %p\n", pci_bus->hw_base); | ||
431 | 435 | ||
432 | pr_info("HW Revision ID = 0x%X\n", pdev->revision); | 436 | dev_printk(KERN_INFO, &pdev->dev, |
437 | "HW Revision ID = 0x%X\n", pdev->revision); | ||
433 | 438 | ||
434 | /* We disable the RETRY_TIMEOUT register (0x41) to keep | 439 | /* We disable the RETRY_TIMEOUT register (0x41) to keep |
435 | * PCI Tx retries from interfering with C3 CPU state */ | 440 | * PCI Tx retries from interfering with C3 CPU state */ |
@@ -437,7 +442,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
437 | 442 | ||
438 | err = pci_enable_msi(pdev); | 443 | err = pci_enable_msi(pdev); |
439 | if (err) { | 444 | if (err) { |
440 | pr_err("pci_enable_msi failed"); | 445 | dev_printk(KERN_ERR, &pdev->dev, "pci_enable_msi failed"); |
441 | goto out_iounmap; | 446 | goto out_iounmap; |
442 | } | 447 | } |
443 | 448 | ||
@@ -491,7 +496,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
491 | { | 496 | { |
492 | struct iwl_bus *bus = pci_get_drvdata(pdev); | 497 | struct iwl_bus *bus = pci_get_drvdata(pdev); |
493 | 498 | ||
494 | iwl_remove(bus->priv); | 499 | iwl_remove(bus->drv_data); |
495 | 500 | ||
496 | iwl_pci_down(bus); | 501 | iwl_pci_down(bus); |
497 | } | 502 | } |
@@ -503,7 +508,7 @@ static int iwl_pci_suspend(struct device *device) | |||
503 | struct pci_dev *pdev = to_pci_dev(device); | 508 | struct pci_dev *pdev = to_pci_dev(device); |
504 | struct iwl_bus *bus = pci_get_drvdata(pdev); | 509 | struct iwl_bus *bus = pci_get_drvdata(pdev); |
505 | 510 | ||
506 | return iwl_suspend(bus->priv); | 511 | return iwl_suspend(bus->drv_data); |
507 | } | 512 | } |
508 | 513 | ||
509 | static int iwl_pci_resume(struct device *device) | 514 | static int iwl_pci_resume(struct device *device) |
@@ -517,7 +522,7 @@ static int iwl_pci_resume(struct device *device) | |||
517 | */ | 522 | */ |
518 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); | 523 | pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); |
519 | 524 | ||
520 | return iwl_resume(bus->priv); | 525 | return iwl_resume(bus->drv_data); |
521 | } | 526 | } |
522 | 527 | ||
523 | static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); | 528 | static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); |