* [PATCH] perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...)
@ 2014-05-28 9:11 Giedrius Rekasius
2014-05-28 10:16 ` walter harms
0 siblings, 1 reply; 5+ messages in thread
From: Giedrius Rekasius @ 2014-05-28 9:11 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Paul Mackerras, Ingo Molnar, Arnaldo Carvalho de Melo,
Thomas Gleixner, H. Peter Anvin, x86, linux-kernel,
kernel-janitors
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 <giedrius.rekasius@gmail.com>
---
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 65bbbea..8cbbb1b 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -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) {
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...)
2014-05-28 9:11 [PATCH] perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...) Giedrius Rekasius
@ 2014-05-28 10:16 ` walter harms
2014-05-28 20:10 ` Giedrius Rekasius
2014-05-28 20:42 ` Thomas Gleixner
0 siblings, 2 replies; 5+ messages in thread
From: walter harms @ 2014-05-28 10:16 UTC (permalink / raw)
To: Giedrius Rekasius
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, Thomas Gleixner, H. Peter Anvin, x86,
linux-kernel, kernel-janitors
Am 28.05.2014 11:11, schrieb Giedrius Rekasius:
> 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 <giedrius.rekasius@gmail.com>
> ---
> arch/x86/kernel/cpu/perf_event_intel_uncore.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index 65bbbea..8cbbb1b 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...)
2014-05-28 10:16 ` walter harms
@ 2014-05-28 20:10 ` Giedrius Rekasius
2014-05-28 20:42 ` Thomas Gleixner
1 sibling, 0 replies; 5+ messages in thread
From: Giedrius Rekasius @ 2014-05-28 20:10 UTC (permalink / raw)
To: walter harms
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, Thomas Gleixner, H. Peter Anvin, x86,
linux-kernel, kernel-janitors
On Wed, May 28, 2014 at 12:16:04PM +0200, walter harms wrote:
>
>
> Am 28.05.2014 11:11, schrieb Giedrius Rekasius:
> > 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 <giedrius.rekasius@gmail.com>
> > ---
> > arch/x86/kernel/cpu/perf_event_intel_uncore.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> > index 65bbbea..8cbbb1b 100644
> > --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> > +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> > @@ -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.
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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...)
2014-05-28 10:16 ` walter harms
2014-05-28 20:10 ` Giedrius Rekasius
@ 2014-05-28 20:42 ` Thomas Gleixner
2014-05-29 20:51 ` Giedrius Rekasius
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2014-05-28 20:42 UTC (permalink / raw)
To: walter harms
Cc: Giedrius Rekasius, Peter Zijlstra, Paul Mackerras, Ingo Molnar,
Arnaldo Carvalho de Melo, H. Peter Anvin, x86, linux-kernel,
kernel-janitors
On Wed, 28 May 2014, walter harms wrote:
> Am 28.05.2014 11:11, schrieb Giedrius Rekasius:
> > 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 <giedrius.rekasius@gmail.com>
> > ---
> > arch/x86/kernel/cpu/perf_event_intel_uncore.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> > index 65bbbea..8cbbb1b 100644
> > --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> > +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> > @@ -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.
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
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH] perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...)
2014-05-28 20:42 ` Thomas Gleixner
@ 2014-05-29 20:51 ` Giedrius Rekasius
0 siblings, 0 replies; 5+ messages in thread
From: Giedrius Rekasius @ 2014-05-29 20:51 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Paul Mackerras, Ingo Molnar, Arnaldo Carvalho de Melo,
Thomas Gleixner, H. Peter Anvin, x86, linux-kernel,
kernel-janitors
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.
Signed-off-by: Giedrius Rekasius <giedrius.rekasius@gmail.com>
---
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(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 65bbbea..6fe20db 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -3813,11 +3813,10 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
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;
- 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) {
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-05-29 20:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-28 9:11 [PATCH] perf/x86/uncore: Remove unnecessary assignment to "box" in uncore_pci_remove(...) Giedrius Rekasius
2014-05-28 10:16 ` walter harms
2014-05-28 20:10 ` Giedrius Rekasius
2014-05-28 20:42 ` Thomas Gleixner
2014-05-29 20:51 ` Giedrius Rekasius
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).