Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1464603

Re: [PATCH 3/3] perf/x86/intel/uncore: Add Skylake server uncore support

From Nilay Vaish <nilayvaish@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] perf/x86/intel/uncore: Add Skylake server uncore support
Date 2016-08-17 16:30 +0200
Message-ID <s7a0V-2dr-9@gated-at.bofh.it> (permalink)
References <s5slj-7eH-3@gated-at.bofh.it> <s5slj-7eH-1@gated-at.bofh.it> <s5I6J-23R-9@gated-at.bofh.it> <s6qU9-6EH-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 15 August 2016 at 09:12, Liang, Kan <kan.liang@intel.com> wrote:
>
>
>> > diff --git a/arch/x86/events/intel/uncore_snbep.c
>> > b/arch/x86/events/intel/uncore_snbep.c
>> > index 3719af5..55a081e 100644
>> > --- a/arch/x86/events/intel/uncore_snbep.c
>> > +++ b/arch/x86/events/intel/uncore_snbep.c
>> > +
>> > +static int skx_count_chabox(void)
>> > +{
>> > +       struct pci_dev *chabox_dev = NULL;
>> > +       int bus, count = 0;
>> > +
>> > +       while (1) {
>> > +               chabox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x208d,
>> chabox_dev);
>> > +               if (!chabox_dev)
>> > +                       break;
>> > +               if (count == 0)
>> > +                       bus = chabox_dev->bus->number;
>> > +               if (bus != chabox_dev->bus->number)
>> > +                       break;
>> > +               count++;
>> > +       }
>> > +
>> > +       pci_dev_put(chabox_dev);
>> > +       return count;
>> > +}
>>
>> Kan,  do we not need to call pci_dev_put() each time we call pci_get_device()?
>
> The pci_get_device will always decrease the reference count for chabox_dev, if
> it is not NULL.
> So I think it's OK to only pci_dev_put it at last.
>

Yup, you are right.  I was not aware that pci_dev_put() gets called
automatically when pci_dev argument is not NULL.
Thanks for the info.

--
Nilay

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] perf/x86/intel/uncore: Add Skylake server uncore support Kan Liang <kan.liang@intel.com> - 2016-08-12 23:40 +0200
  Re: [PATCH 3/3] perf/x86/intel/uncore: Add Skylake server uncore support Nilay Vaish <nilayvaish@gmail.com> - 2016-08-13 16:30 +0200
    RE: [PATCH 3/3] perf/x86/intel/uncore: Add Skylake server uncore  support "Liang, Kan" <kan.liang@intel.com> - 2016-08-15 16:20 +0200
      Re: [PATCH 3/3] perf/x86/intel/uncore: Add Skylake server uncore support Nilay Vaish <nilayvaish@gmail.com> - 2016-08-17 16:30 +0200

csiph-web