From: John Garry <john.garry@huawei.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Yang Yingliang <yangyingliang@huawei.com>
Subject: Re: [PATCH v3] hisi_lpc: Use acpi_dev_for_each_child()
Date: Fri, 1 Jul 2022 13:18:37 +0100 [thread overview]
Message-ID: <df8c0a5d-e950-1726-5d30-80dcc8b20ff9@huawei.com> (raw)
In-Reply-To: <CAHp75VdxaBG8Sj3j7Wa7BrZOrn1j2eAtJMw0N8z255HwMSohYw@mail.gmail.com>
On 01/07/2022 13:05, Andy Shevchenko wrote:
> On Fri, Jul 1, 2022 at 1:54 PM John Garry <john.garry@huawei.com> wrote:
>> On 01/07/2022 12:07, Andy Shevchenko wrote:
>>> On Fri, Jul 1, 2022 at 1:06 PM Andy Shevchenko
>>> <andy.shevchenko@gmail.com> wrote:
>>>> On Fri, Jul 1, 2022 at 1:04 PM John Garry <john.garry@huawei.com> wrote:
>>>>> On 30/06/2022 19:13, Rafael J. Wysocki wrote:
>
> ...
>
>>>>> However Yang Yingliang spotted a pre-existing bug in the ACPI probe and
>>>>> sent a fix today (coincidence?):
>>>>>
>>>>> https://lore.kernel.org/lkml/20220701094352.2104998-1-yangyingliang@huawei.com/T/#u
>>>>>
>>>>> And they conflict. This code has been this way for years, so I just
>>>>> suggest Yang Yingliang resends the fix on top off Rafael's change.
>>>>
>>>> Wondering if Yang can actually switch that to use
>>>> platform_device_register_full().
>>
>> Maybe that would work and simplify things. Let me check it.
>>
>> BTW, when we originally upstreamed this driver there was some ACPI
>> platform device registration code which you/we thought could be factored
>> out later. I can't remember it. I was looking through lore but couldn't
>> find it. I don't remember it being so important, though.
>
> My suggestion is definitely not for the fix itself, but as a follow up.
FWIW, it works out quite neatly:
diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c
index e0fee1f863e6..70198d5644c7 100644
--- a/drivers/bus/hisi_lpc.c
+++ b/drivers/bus/hisi_lpc.c
@@ -472,9 +472,7 @@ static int hisi_lpc_acpi_clear_enumerated(struct
acpi_device *adev, void *not_us
struct hisi_lpc_acpi_cell {
const char *hid;
- const char *name;
- void *pdata;
- size_t pdata_size;
+ struct platform_device_info pdevinfo;
};
static void hisi_lpc_acpi_remove(struct device *hostdev)
@@ -505,28 +503,36 @@ static int hisi_lpc_acpi_add_child(struct
acpi_device *child, void *data)
/* ipmi */
{
.hid = "IPI0001",
- .name = "hisi-lpc-ipmi",
+ .pdevinfo = {
+ .name = "hisi-lpc-ipmi",
+ .num_res = num_res,
+ .res = res,
+ },
},
/* 8250-compatible uart */
{
.hid = "HISI1031",
- .name = "serial8250",
- .pdata = (struct plat_serial8250_port []) {
- {
- .iobase = res->start,
- .uartclk = 1843200,
- .iotype = UPIO_PORT,
- .flags = UPF_BOOT_AUTOCONF,
+ .pdevinfo = {
+ .name = "serial8250",
+ .data = (struct plat_serial8250_port []) {
+ {
+ .iobase = res->start,
+ .uartclk = 1843200,
+ .iotype = UPIO_PORT,
+ .flags = UPF_BOOT_AUTOCONF,
+ },
+ {}
},
- {}
+ .size_data = 2 *
+ sizeof(struct plat_serial8250_port),
+ .num_res = num_res,
+ .res = res,
},
- .pdata_size = 2 *
- sizeof(struct plat_serial8250_port),
},
{}
};
- for (; cell && cell->name; cell++) {
+ for (; cell && cell->pdevinfo.name; cell++) {
if (!strcmp(cell->hid, hid)) {
found = true;
break;
@@ -540,25 +546,13 @@ static int hisi_lpc_acpi_add_child(struct
acpi_device *child, void *data)
return 0;
}
- pdev = platform_device_alloc(cell->name, PLATFORM_DEVID_AUTO);
+ pdev = platform_device_register_full(&cell->pdevinfo);
if (!pdev)
return -ENOMEM;
pdev->dev.parent = hostdev;
ACPI_COMPANION_SET(&pdev->dev, child);
- ret = platform_device_add_resources(pdev, res, num_res);
- if (ret)
- return ret;
-
- ret = platform_device_add_data(pdev, cell->pdata, cell->pdata_size);
- if (ret)
- return ret;
-
- ret = platform_device_add(pdev);
- if (ret)
- return ret;
-
acpi_device_set_enumerated(child);
return 0;
>
>>> And for the record, I think the Fixes even for very rare bug hits
>>> should go first.
>>
>> ok, I have to admit that I was going to feel awkward asking Rafael to
>> deal with this fix by having a v4 on top of it.
>
> I don't think it's a problem as long as we have an immutable branch /
> tag with that patch. Another approach could be that Rafael can take it
> as a precursor for his series and route via ACPI tree, but let's hear
> what he thinks about this himself.
>
ok, fine.
Thanks,
John
next prev parent reply other threads:[~2022-07-01 12:18 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 12:55 [PATCH] hisi_lpc: Use acpi_dev_for_each_child() Rafael J. Wysocki
2022-06-29 13:33 ` John Garry
2022-06-29 13:38 ` Rafael J. Wysocki
2022-06-29 13:47 ` [PATCH v2] " Rafael J. Wysocki
2022-06-30 12:48 ` Rafael J. Wysocki
2022-06-30 13:37 ` John Garry
2022-06-30 13:40 ` Rafael J. Wysocki
2022-06-30 18:13 ` [PATCH v3] " Rafael J. Wysocki
2022-07-01 8:34 ` Greg Kroah-Hartman
2022-07-01 10:49 ` John Garry
2022-07-01 11:06 ` Andy Shevchenko
2022-07-01 11:07 ` Andy Shevchenko
2022-07-01 11:54 ` John Garry
2022-07-01 12:05 ` Andy Shevchenko
2022-07-01 12:18 ` John Garry [this message]
2022-07-04 19:02 ` Rafael J. Wysocki
2022-07-05 8:37 ` John Garry
2022-07-05 9:38 ` Andy Shevchenko
2022-07-05 9:39 ` Andy Shevchenko
2022-07-05 10:16 ` John Garry
2022-07-05 10:29 ` Andy Shevchenko
2022-07-05 13:54 ` Rafael J. Wysocki
2022-07-05 15:16 ` John Garry
2022-07-05 15:34 ` Rafael J. Wysocki
2022-08-09 10:35 ` John Garry
2022-07-05 15:08 ` Rafael J. Wysocki
2022-07-01 18:16 ` Rafael J. Wysocki
2022-07-01 18:19 ` Rafael J. Wysocki
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=df8c0a5d-e950-1726-5d30-80dcc8b20ff9@huawei.com \
--to=john.garry@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=yangyingliang@huawei.com \
/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