mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Brunner <michael.brunner@kontron.com>
To: "linux@roeck-us.net" <linux@roeck-us.net>,
	"lee@kernel.org" <lee@kernel.org>
Cc: "mibru@gmx.de" <mibru@gmx.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mfd: kempld-core: don't replace resources provided by ACPI
Date: Wed, 21 Feb 2024 17:50:31 +0000	[thread overview]
Message-ID: <de6bc09c779a4b4fa2ddaa1fa3a595de323b7f5a.camel@kontron.com> (raw)
In-Reply-To: <8ec638c2-93b6-48e4-8ac4-965072b1d5af@roeck-us.net>

Added Lee Jones again, as I erroneously used an old eMail address in
my original mail.

Thanks Guenter, for the review!

On Wed, 2024-02-21 at 09:34 -0800, Guenter Roeck wrote:
>> The current implementation to retrieve ACPI resources is faulty
>> and may cause issues that even can lead to non-booting systems.
>>
>> When adding data from an ACPI device, the resources are already
>> assigned to the platform device. Therefore there is no need to
>> retrieve the resource list from ACPI and manually assign it to
>> the platform device. Also there shouldn't be any BIOS in the wild
>> anymore, that does not have resources added to the KEMPLD ACPI
>> data.
>>
>> In particular this fixes an issue where the retrieval of the
>> resource list using /proc/ioports is disturbed and does not list
>> the assigned resource for the kempld device or even no resources
>> at all.
>> On some distributions this also leads to problems during system
>> initialization (e.g. with udev) and causes the system to not
>> boot at all.
>>
>> I have reproduced the issue with the following kernel versions:
>>      5.10.209
>>      5.15.148
>>      6.1.25
>>      6.6.17
>>      6.7.5
>>      6.8-rc5
>>
>> The patch applies to all of those versions and seems to resolve
>> the issue.
>>
>> Signed-off-by: Michael Brunner <michael.brunner@kontron.com>
>
>Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>
>> ---
>>   drivers/mfd/kempld-core.c | 37 -------------------------------------
>>   1 file changed, 37 deletions(-)
>>
>> diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c
>> index 67af36a38913..5557f023a173 100644
>> --- a/drivers/mfd/kempld-core.c
>> +++ b/drivers/mfd/kempld-core.c
>> @@ -428,50 +428,13 @@ static int kempld_detect_device(struct kempld_device_data *pld)
>>   #ifdef CONFIG_ACPI
>>   static int kempld_get_acpi_data(struct platform_device *pdev)
>>   {
>> -     struct list_head resource_list;
>> -     struct resource *resources;
>> -     struct resource_entry *rentry;
>>       struct device *dev = &pdev->dev;
>> -     struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
>>       const struct kempld_platform_data *pdata;
>>       int ret;
>> -     int count;
>>
>>       pdata = acpi_device_get_match_data(dev);
>>       ret = platform_device_add_data(pdev, pdata,
>>                                      sizeof(struct kempld_platform_data));
>> -     if (ret)
>> -             return ret;
>> -
>> -     INIT_LIST_HEAD(&resource_list);
>> -     ret = acpi_dev_get_resources(acpi_dev, &resource_list, NULL, NULL);
>> -     if (ret < 0)
>> -             goto out;
>> -
>> -     count = ret;
>> -
>> -     if (count == 0) {
>> -             ret = platform_device_add_resources(pdev, pdata->ioresource, 1);
>> -             goto out;
>> -     }
>> -
>> -     resources = devm_kcalloc(&acpi_dev->dev, count, sizeof(*resources),
>> -                              GFP_KERNEL);
>> -     if (!resources) {
>> -             ret = -ENOMEM;
>> -             goto out;
>> -     }
>> -
>> -     count = 0;
>> -     list_for_each_entry(rentry, &resource_list, node) {
>> -             memcpy(&resources[count], rentry->res,
>> -                    sizeof(*resources));
>> -             count++;
>> -     }
>> -     ret = platform_device_add_resources(pdev, resources, count);
>> -
>> -out:
>> -     acpi_dev_free_resource_list(&resource_list);
>>
>>       return ret;
>>   }

  reply	other threads:[~2024-02-21 17:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 17:10 Michael Brunner
2024-02-21 17:34 ` Guenter Roeck
2024-02-21 17:50   ` Michael Brunner [this message]
2024-02-23 10:52     ` Lee Jones
2024-02-23 11:03       ` [PATCH RESEND] " Michael Brunner
2024-02-23 12:39         ` Michael Brunner
2024-02-23 17:10           ` (subset) " Lee Jones
2024-02-23 12:50       ` [PATCH] " Michael Brunner

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=de6bc09c779a4b4fa2ddaa1fa3a595de323b7f5a.camel@kontron.com \
    --to=michael.brunner@kontron.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mibru@gmx.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 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®