perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...)
Subsystems (3)
PATCH 1/1 perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...)
Local variable "box" gets assigned correct value when it is initialized. There is no need to assign the same value again.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +0 -1
@@ -3817,7 +3817,6 @@ static void uncore_pci_remove(struct pci_dev *pdev)struct intel_uncore_pmu *pmu;int i, cpu, phys_id = pcibus_to_physid[pdev->bus->number]; - box =pci_get_drvdata (pdev);if (!box) {for (i =0 ; i <UNCORE_EXTRA_PCI_DEV_MAX ; i++) {if (extra_pci_dev[phys_id][i] = pdev) {
Signature · 1 line
1.9.3
Am 28.05.2014 11:11, schrieb Giedrius Rekasius:
Quoted 13 lines
Local variable "box" gets assigned correct value when it is initialized. There is no need to assign the same value again.
Signed-off-by Giedrius Rekasius <[email protected]>--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 1 - 1 file changed, 1 deletion(-)arch/x86/kernel/cpu/perf_event_intel_uncore.c +0
-0
arch/x86/kernel/cpu/perf_event_intel_uncore.c static void uncore_pci_remove(struct pci_dev *pdev) · line 3822
Quoted 7 lines
arch/x86/kernel/cpu/perf_event_intel_uncore.c +0
-1@@ -3817,7 +3817,6 @@ static void uncore_pci_remove(struct pci_dev *pdev)struct intel_uncore_pmu *pmu;int i, cpu, phys_id = pcibus_to_physid[pdev->bus->number]; - box =pci_get_drvdata (pdev);if (!box) {for (i =0 ; i <UNCORE_EXTRA_PCI_DEV_MAX ; i++) {if (extra_pci_dev[phys_id][i] = pdev) {
Just a remark,
for readability it is better to remove the other one.
re,
wh
Quoted 19 lines · walter harms
Am 28.05.2014 11:11, schrieb Giedrius Rekasius:
Quoted 16 lines
Local variable "box" gets assigned correct value when it is initialized. There is no need to assign the same value again.
Signed-off-by Giedrius Rekasius <[email protected]>--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 1 - 1 file changed, 1 deletion(-)arch/x86/kernel/cpu/perf_event_intel_uncore.c +0
-0@@ -3817,7 +3817,6 @@ static void uncore_pci_remove(struct pci_dev *pdev)struct intel_uncore_pmu *pmu;int i, cpu, phys_id = pcibus_to_physid[pdev->bus->number];
Quoted 7 lines
arch/x86/kernel/cpu/perf_event_intel_uncore.c static void uncore_pci_remove(struct pci_dev *pdev) · line 3822
Quoted 4 lines
arch/x86/kernel/cpu/perf_event_intel_uncore.c +0
-1- box =pci_get_drvdata (pdev);if (!box) {for (i =0 ; i <UNCORE_EXTRA_PCI_DEV_MAX ; i++) {if (extra_pci_dev[phys_id][i] = pdev) {Just a remark,
for readability it is better to remove the other one.
I could move the declaration itself closer to the if statement while still keeping whole statement in one line.
On the other hand I'm not so sure if it makes any real difference to have assignment right next to the if statement compared to a few lines above it.
Regards,
Giedrius
Quoted 17 lines · walter harms
Am 28.05.2014 11:11, schrieb Giedrius Rekasius:
Quoted 16 lines
Local variable "box" gets assigned correct value when it is initialized. There is no need to assign the same value again.
Signed-off-by Giedrius Rekasius <[email protected]>--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 1 - 1 file changed, 1 deletion(-)arch/x86/kernel/cpu/perf_event_intel_uncore.c +0
-0@@ -3817,7 +3817,6 @@ static void uncore_pci_remove(struct pci_dev *pdev)struct intel_uncore_pmu *pmu;int i, cpu, phys_id = pcibus_to_physid[pdev->bus->number];
Quoted 7 lines
arch/x86/kernel/cpu/perf_event_intel_uncore.c static void uncore_pci_remove(struct pci_dev *pdev) · line 3822
Quoted 4 lines
arch/x86/kernel/cpu/perf_event_intel_uncore.c +0
-1- box =pci_get_drvdata (pdev);if (!box) {for (i =0 ; i <UNCORE_EXTRA_PCI_DEV_MAX ; i++) {if (extra_pci_dev[phys_id][i] = pdev) {Just a remark,
for readability it is better to remove the other one.
I rather have stuff reshuffled a bit more:
static void uncore_pci_remove(struct pci_dev *pdev)
{
int i, cpu, phys_id = pcibus_to_physid[pdev->bus->number];
struct intel_uncore_box *box = pci_get_drvdata(pdev);
struct intel_uncore_pmu *pmu;
if (!box) {That's less lines and entirely readable.
Thanks,
tglx
PATCH 1/1 perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...)
Local variable "box" gets assigned correct value when it is initialized. There is no need to assign the same value again. Variable declarations were reshuffled for better readability.
---
Original patch was amended for better readability based on feedback from Walter Harms and Thomas Gleixner.
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +1 -2
@@ -3813,11 +3813,10 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *idstatic void uncore_pci_remove (struct pci_dev *pdev) { +int i, cpu, phys_id = pcibus_to_physid[pdev->bus->number];struct intel_uncore_box *box =pci_get_drvdata (pdev);struct intel_uncore_pmu *pmu; -int i, cpu, phys_id = pcibus_to_physid[pdev->bus->number]; - box =pci_get_drvdata (pdev);if (!box) {for (i =0 ; i <UNCORE_EXTRA_PCI_DEV_MAX ; i++) {if (extra_pci_dev[phys_id][i] = pdev) {
Signature · 1 line
1.9.3