From: sathyanarayanan kuppuswamy <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
"x86@kernel.org" <x86@kernel.org>,
Wim Van Sebroeck <wim@iguana.be>, Ingo Molnar <mingo@redhat.com>,
Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Zha Qipeng <qipeng.zha@intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"dvhart@infradead.org" <dvhart@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Lee Jones <lee.jones@linaro.org>,
Andy Shevchenko <andy@infradead.org>,
Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>,
linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Platform Driver <platform-driver-x86@vger.kernel.org>,
Sathyanarayanan Kuppuswamy Natarajan <sathyaosid@gmail.com>
Subject: Re: [RFC v3 4/7] platform: x86: Add generic Intel IPC driver
Date: Tue, 3 Oct 2017 18:07:18 -0700 [thread overview]
Message-ID: <96f8c550-da66-c11f-4db4-34fe520188aa@linux.intel.com> (raw)
In-Reply-To: <CAHp75VecDGzs=esey6hSDWMxvYPeeiy5T-9x6MNFaHspLq0ctA@mail.gmail.com>
Hi,
On 10/01/2017 07:59 AM, Andy Shevchenko wrote:
> On Tue, Sep 5, 2017 at 8:37 AM,
> <sathyanarayanan.kuppuswamy@linux.intel.com> wrote:
>> From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>>
>> Currently intel_scu_ipc.c, intel_pmc_ipc.c and intel_punit_ipc.c
>> redundantly implements the same IPC features and has lot of code
>> duplication between them. This driver addresses this issue by grouping
>> the common IPC functionalities under the same driver.
>> +static const char *ipc_dev_err_string(struct intel_ipc_dev *ipc_dev,
>> + int error)
>> +{
>> + switch (error) {
>> + case IPC_DEV_ERR_NONE:
>> + return "No error";
>> + case IPC_DEV_ERR_CMD_NOT_SUPPORTED:
>> + return "Command not-supported/Invalid";
>> + case IPC_DEV_ERR_CMD_NOT_SERVICED:
>> + return "Command not-serviced/Invalid param";
>> + case IPC_DEV_ERR_UNABLE_TO_SERVICE:
>> + return "Unable-to-service/Cmd-timeout";
>> + case IPC_DEV_ERR_CMD_INVALID:
>> + return "Command-invalid/Cmd-locked";
>> + case IPC_DEV_ERR_CMD_FAILED:
>> + return "Command-failed/Invalid-VR-id";
>> + case IPC_DEV_ERR_EMSECURITY:
>> + return "Invalid Battery/VR-Error";
>> + case IPC_DEV_ERR_UNSIGNEDKERNEL:
>> + return "Unsigned kernel";
>> + default:
>> + return "Unknown Command";
>> + };
>> +}
> Since it's continuous list you can define an array of messages like
>
> const char * const *errors = {
> [..._ERR_...] = "",
> ...
>
> };
>
> Also you can use enum in the header and define _ERR_MAX there.
> Thus, code would be transformed to
>
> if (error < _ERR_MAX)
> return errors[error];
>
> return "Unknown Command";
Thanks will fix it in next version.
>
--
Sathyanarayanan Kuppuswamy
Linux kernel developer
next prev parent reply other threads:[~2017-10-04 1:07 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-05 5:37 [RFC v3 0/7] PMC/PUNIT IPC driver cleanup sathyanarayanan.kuppuswamy
2017-09-05 5:37 ` sathyanarayanan.kuppuswamy-VuQAYsv1563Yd54FQh9/CA
2017-09-05 5:37 ` [RFC v3 1/7] platform/x86: intel_pmc_ipc: Use devm_* calls in driver probe function sathyanarayanan.kuppuswamy
2017-10-01 14:34 ` Andy Shevchenko
2017-10-04 0:55 ` sathyanarayanan kuppuswamy
2017-09-05 5:37 ` [RFC v3 2/7] platform/x86: intel_pmc_ipc: Use MFD framework to create dependent devices sathyanarayanan.kuppuswamy
2017-10-01 14:44 ` Andy Shevchenko
2017-10-04 1:00 ` sathyanarayanan kuppuswamy
2017-10-04 12:34 ` Andy Shevchenko
2017-09-05 5:37 ` [RFC v3 3/7] platform/x86: intel_pmc_ipc: Use regmap calls for GCR updates sathyanarayanan.kuppuswamy
2017-10-01 14:48 ` Andy Shevchenko
2017-10-04 1:16 ` sathyanarayanan kuppuswamy
2017-10-04 1:16 ` sathyanarayanan kuppuswamy
2017-10-04 12:37 ` Andy Shevchenko
2017-09-05 5:37 ` [RFC v3 4/7] platform: x86: Add generic Intel IPC driver sathyanarayanan.kuppuswamy
2017-10-01 14:59 ` Andy Shevchenko
2017-10-01 14:59 ` Andy Shevchenko
2017-10-04 1:07 ` sathyanarayanan kuppuswamy [this message]
2017-09-05 5:37 ` [RFC v3 5/7] platform/x86: intel_punit_ipc: Use generic intel ipc device calls sathyanarayanan.kuppuswamy
2017-09-05 5:37 ` [RFC v3 6/7] platform/x86: intel_pmc_ipc: Use generic Intel IPC " sathyanarayanan.kuppuswamy
2017-09-05 5:37 ` [RFC v3 7/7] platform/x86: intel_scu_ipc: " sathyanarayanan.kuppuswamy
2017-09-28 12:55 ` Alexandre Belloni
2017-09-28 12:55 ` Alexandre Belloni
2017-09-28 13:35 ` Guenter Roeck
2017-10-04 0:55 ` sathyanarayanan kuppuswamy
2017-10-04 0:32 ` sathyanarayanan kuppuswamy
2017-10-01 14:46 ` [RFC v3 0/7] PMC/PUNIT IPC driver cleanup Andy Shevchenko
2017-10-01 14:46 ` Andy Shevchenko
2017-10-04 1:06 ` sathyanarayanan kuppuswamy
2017-10-04 1:06 ` sathyanarayanan kuppuswamy
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=96f8c550-da66-c11f-4db4-34fe520188aa@linux.intel.com \
--to=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@free-electrons.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@infradead.org \
--cc=dvhart@infradead.org \
--cc=hpa@zytor.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=qipeng.zha@intel.com \
--cc=sathyaosid@gmail.com \
--cc=souvik.k.chakravarty@intel.com \
--cc=tglx@linutronix.de \
--cc=wim@iguana.be \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.