All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hoan Tran <hotran@apm.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>,
	Loc Ho <lho@apm.com>, Keyur Chudgar <kchudgar@apm.com>
Subject: Re: [PATCH 2/2] i2c: xgene-slimpro: Add ACPI support by using PCC mailbox
Date: Thu, 20 Apr 2017 13:38:53 -0700	[thread overview]
Message-ID: <CAFHUOYxfivQ6kQwBwyX5X8QESbCFo4E_KM5iFHyjuChtTZq+uQ@mail.gmail.com> (raw)
In-Reply-To: <20170420080552.7hymw4gqy4kzecns@ninjato>

Hi Wolfram,

On Thu, Apr 20, 2017 at 1:05 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> Hi,
>
> have you tested these patches also without PCC? So, we can be sure there
> is no regression?

These patches are tested with/without PCC.

>
>> diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
>> index 96545aa..a5771c1 100644
>> --- a/drivers/i2c/busses/i2c-xgene-slimpro.c
>> +++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
>> @@ -32,6 +32,8 @@
>>  #include <linux/platform_device.h>
>>  #include <linux/version.h>
>>
>> +#include <acpi/pcc.h>
>> +
>
> Please keep it sorted alphabetically.
>
>> +#define PCC_CMD_GENERATE_DB_INT              BIT(15)
>> +#define PCC_STS_CMD_COMPLETE         BIT(0)
>> +#define PCC_STS_SCI_DOORBELL         BIT(1)
>> +#define PCC_STS_ERR                  BIT(2)
>> +#define PCC_STS_PLAT_NOTIFY          BIT(3)
>
> Please keep it sorted by number.
>
>> +     if (!acpi_disabled) {
>> +             mutex_lock(&ctx->tx_mutex);
>> +             init_completion(&ctx->rd_complete);
>
> reinit_completion?

OK,

>
>> +             slimpro_i2c_pcc_tx_prepare(ctx, msg);
>> +     }
>> +
>> +     mutex_init(&ctx->tx_mutex);
>
> Why this mutex, by the way? The i2c-core serializes access to the
> adapter. Maybe I am missing something?

That's a good point, let me remove this mutex.

>
>> +             cppc_ss = ctx->mbox_chan->con_priv;
>> +             if (!cppc_ss) {
>> +                     dev_err(&pdev->dev, "PPC subspace not found\n");
>> +                     rc = -ENODEV;
>> +                     goto mbox_err;
>> +             }
>> +
>> +             if (!ctx->mbox_chan->mbox->txdone_irq) {
>> +                     dev_err(&pdev->dev, "PCC IRQ not supported\n");
>> +                     rc = -ENODEV;
>> +                     goto mbox_err;
>> +             }
>>
>> +             /*
>> +              * This is the shared communication region
>> +              * for the OS and Platform to communicate over.
>> +              */
>> +             ctx->comm_base_addr = cppc_ss->base_address;
>> +             if (ctx->comm_base_addr) {
>> +                     ctx->pcc_comm_addr = memremap(ctx->comm_base_addr,
>> +                                                   cppc_ss->length,
>> +                                                   MEMREMAP_WB);
>> +             } else {
>> +                     dev_err(&pdev->dev, "Failed to get PCC comm region\n");
>> +                     rc = -ENODEV;
>> +                     goto mbox_err;
>> +             }
>
> I think it doesn't make sense to print a dev_err and return ENODEV which
> is treated by the driver core as a non-error. It means "not present, but
> OK". You probably want other error codes here.

How about -EINVAL for these -ENODEV error codes? Do you have any suggestion?

Thank for your comments!
Hoan


>
> Regards,
>
>    Wolfram
>

  reply	other threads:[~2017-04-20 20:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 20:46 [PATCH 0/2] i2c: xgene-slimpro: Add ACPI support Hoan Tran
2017-03-28 20:46 ` [PATCH 1/2] i2c: xgene-slimpro: Use a single function to send command message Hoan Tran
2017-03-28 20:46 ` [PATCH 2/2] i2c: xgene-slimpro: Add ACPI support by using PCC mailbox Hoan Tran
2017-04-20  8:05   ` Wolfram Sang
2017-04-20 20:38     ` Hoan Tran [this message]
2017-04-21  6:31       ` Wolfram Sang
2017-04-17 16:36 ` [PATCH 0/2] i2c: xgene-slimpro: Add ACPI support Hoan Tran

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=CAFHUOYxfivQ6kQwBwyX5X8QESbCFo4E_KM5iFHyjuChtTZq+uQ@mail.gmail.com \
    --to=hotran@apm.com \
    --cc=kchudgar@apm.com \
    --cc=lho@apm.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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.