mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sathya <sathyaosid@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Kuppuswamy Sathyanarayanan 
	<sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: "x86@kernel.org" <x86@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Zha Qipeng <qipeng.zha@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"dvhart@infradead.org" <dvhart@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andy Shevchenko <andy@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>
Subject: Re: [RFC v1 3/6] platform/x86: intel_pmc_ipc: Use MFD framework to create dependent devices
Date: Mon, 21 Aug 2017 22:02:31 -0700	[thread overview]
Message-ID: <1b46f01c-9cc8-3541-2f6d-f42c89c627ee@gmail.com> (raw)
In-Reply-To: <CAHp75VcLs_+CcWMaBwR8ZMpByrNc74j7eF16K6ASF4NxaF0zHg@mail.gmail.com>

Hi Andy,


On 08/18/2017 05:29 AM, Andy Shevchenko wrote:
> On Tue, Aug 1, 2017 at 9:13 PM,
> <sathyanarayanan.kuppuswamy@linux.intel.com> wrote:
>
>> Currently, we have lot of repetitive code in dependent device resource
>> allocation and device creation handling code. This logic can be improved if
>> we use MFD framework for dependent device creation. This patch adds this
>> support.
>> +static int ipc_create_pmc_devices(struct platform_device *pdev)
>>   {
>> -       int ret;
>> -
>> -       /* If we have ACPI based watchdog use that instead */
>> +       u8 n = 0;
>> +       struct mfd_cell *pmc_mfd_cells;
>> +
>> +       pmc_mfd_cells = devm_kzalloc(&pdev->dev,
>> +                       (sizeof(*pmc_mfd_cells) * PMC_IPC_MAX_MFD_BLOCK),
>> +                       GFP_KERNEL);
>> +       if (!pmc_mfd_cells)
>> +               return -ENOMEM;
>> +
>> +       /* Create PUNIT IPC MFD cell */
>> +       pmc_mfd_cells[n].name = PUNIT_DEVICE_NAME;
>> +       pmc_mfd_cells[n].id = -1;
>> +       pmc_mfd_cells[n].num_resources = ARRAY_SIZE(punit_ipc_resources);
>> +       pmc_mfd_cells[n].resources = punit_ipc_resources;
>> +       pmc_mfd_cells[n].ignore_resource_conflicts = 1;
> Please, use static variables instead of allocated on a heap.
I will follow the model used in lpc_ich.c. Will fix it in next version.
>
>> +       n++;
>> +
>> +       /* If we have ACPI based watchdog use that instead, othewise create
>> +        * a MFD cell for iTCO watchdog*/
>>          if (!acpi_has_watchdog()) {
>> +               pmc_mfd_cells[n].name = TCO_DEVICE_NAME;
>> +               pmc_mfd_cells[n].id = -1;
>> +               pmc_mfd_cells[n].platform_data = &tco_info;
>> +               pmc_mfd_cells[n].pdata_size = sizeof(tco_info);
>> +               pmc_mfd_cells[n].num_resources =
>> +                       ARRAY_SIZE(watchdog_ipc_resources);
>> +               pmc_mfd_cells[n].resources = watchdog_ipc_resources;
>> +               pmc_mfd_cells[n].ignore_resource_conflicts = 1;
>> +               n++;
>>          }
> ...and here you do mfd_add_devices() instead of this stuff.
>
> Check how lpc_ich.c designed.
Will fix it in next version.
>

-
Sathya

  reply	other threads:[~2017-08-22  5:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 18:13 [RFC v1 0/6] PMC/PUNIT IPC driver cleanup sathyanarayanan.kuppuswamy
2017-08-01 18:13 ` [RFC v1 1/6] platform/x86: intel_pmc_ipc: Fix error handling in ipc_pci_probe() sathyanarayanan.kuppuswamy
2017-08-18 12:22   ` Andy Shevchenko
2017-08-22  5:01     ` sathya
2017-08-01 18:13 ` [RFC v1 2/6] platform/x86: intel_pmc_ipc: Use devm_* calls in driver probe sathyanarayanan.kuppuswamy
2017-08-18 12:24   ` Andy Shevchenko
2017-08-22  5:05     ` sathya
2017-08-22  9:45       ` Andy Shevchenko
2017-08-01 18:13 ` [RFC v1 3/6] platform/x86: intel_pmc_ipc: Use MFD framework to create dependent devices sathyanarayanan.kuppuswamy
2017-08-02  5:14   ` Chakravarty, Souvik K
2017-08-02 21:59     ` sathyanarayanan kuppuswamy
2017-08-03  3:03       ` Chakravarty, Souvik K
2017-08-18 12:29   ` Andy Shevchenko
2017-08-22  5:02     ` sathya [this message]
2017-08-01 18:13 ` [RFC v1 4/6] platform: x86: Add generic Intel IPC driver sathyanarayanan.kuppuswamy
2017-08-18 12:38   ` Andy Shevchenko
2017-08-22  5:09     ` sathya
2017-08-22  9:50       ` Andy Shevchenko
2017-08-01 18:13 ` [RFC v1 5/6] platform/x86: intel_punit_ipc: Use generic intel ipc device calls sathyanarayanan.kuppuswamy
2017-08-01 18:13 ` [RFC v1 6/6] platform/x86: intel_pmc_ipc: Use generic Intel IPC " sathyanarayanan.kuppuswamy
2017-08-06 18:37 ` [RFC v1 0/6] PMC/PUNIT IPC driver cleanup Andy Shevchenko
2017-08-18 12:44 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b46f01c-9cc8-3541-2f6d-f42c89c627ee@gmail.com \
    --to=sathyaosid@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=qipeng.zha@intel.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®