From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFE60C31E5B for ; Mon, 17 Jun 2019 22:08:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B30812063F for ; Mon, 17 Jun 2019 22:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560809338; bh=1q584dxPj0tHL6IJ5I0J0yEMMuBkm4CwNTjDTAdjQd0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=ZtVDzuL28FcrHmQOvyqO/AqFeJ9BPO2A2FEyUufCNIuN576HrWITSx3XgaRwhY6pA 0MiOt8qOyu9LLPe7mxXt8zJHp3HNuVm5qg4j9mJX0iThwVU3bKrrmlJmNsV/kYYkfZ mTQkd7jIwJESDlDhLbJ9EZdeKAMEJEvgOXaK21Fg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726733AbfFQWI6 (ORCPT ); Mon, 17 Jun 2019 18:08:58 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:37982 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725870AbfFQWI6 (ORCPT ); Mon, 17 Jun 2019 18:08:58 -0400 Received: by mail-ot1-f65.google.com with SMTP id d17so11424336oth.5; Mon, 17 Jun 2019 15:08:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eVGovsCu3s9xFzYqs76/OOxU3RO0LqN3L2Me3A6QEbQ=; b=Iez6Cho4OX3qJVGIHaiLwlHikZE+OBfgxoH3Aj+AeLQWuF5AvCL5ly9Hr3jDgAEJ9y 6j7/gN1qyHDmxKD0CJFwWfkqo/obn03ZiTTTQ+dqxOxG9Ir8h7oYQcXXOKDz6u/Xj7nv zGOzTPHlHN/3R3s+e7pN4yKNGiBVdrFdwuJDMEDQnZ8widg6lAzaxcy9G4pVZ/xD/QPj GtVpkoV2jozVvhyfJh020vj1J2HAnCvpAZxqHh7J/TRKlsCxVEhEJe66QTrK7f47o9Nw 0P0pU9RSJkaoUh111pRp8bZ/U+Bz5MO94hMCk8G7gyR7dmO0VZ5yXJE5MhlvzDtm4BV2 2xDw== X-Gm-Message-State: APjAAAX9D9qq/jJFCF1i7WsG4uhLa2jUvDq1fsndIZvACpys4RfcBNEM q1RmTKHAeOvz4j1XhyO3zMG1SEhRIlMKBwDk5RNOvw== X-Google-Smtp-Source: APXvYqyUG5kdCBMqwHnpebHjBONA84oIsXKvQ35/wbQ7U81k8BKi3Bow7ZGeutN6gWFecLhz9R7A8bl/Ab+v1fA46Ls= X-Received: by 2002:a9d:5e99:: with SMTP id f25mr32700216otl.262.1560809337167; Mon, 17 Jun 2019 15:08:57 -0700 (PDT) MIME-Version: 1.0 References: <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com> <1560534863-15115-4-git-send-email-suzuki.poulose@arm.com> In-Reply-To: <1560534863-15115-4-git-send-email-suzuki.poulose@arm.com> From: "Rafael J. Wysocki" Date: Tue, 18 Jun 2019 00:08:45 +0200 Message-ID: Subject: Re: [PATCH v2 03/28] acpi: utils: Cleanup acpi_dev_match_cb To: Suzuki K Poulose Cc: Linux Kernel Mailing List , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List Content-Type: text/plain; charset="UTF-8" Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, Jun 14, 2019 at 7:54 PM Suzuki K Poulose wrote: > > The prototype of bus_find_device() will be unified with that of > class_find_device() subsequently, but for this purpose the callback > functions passed to it need to take (const void *) as the second > argument. Consequently, they cannot modify the memory pointed to by > that argument which currently is not the case for acpi_dev_match_cb(). > However, acpi_dev_match_cb() really need not modify the "match" object > passed to it, because acpi_dev_get_first_match_dev() which uses it via > bus_find_device() can easily convert the result of bus_find_device() > into the pointer to return. > > For this reason, update acpi_dev_match_cb() to avoid the redundant > memory updates. > > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Cc: Len Brown > Cc: linux-acpi@vger.kernel.org > Signed-off-by: Suzuki K Poulose Reviewed-by: Rafael J. Wysocki Or if you want me to take this patch, please let me know. > --- > drivers/acpi/utils.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c > index 7def63a..1391b63 100644 > --- a/drivers/acpi/utils.c > +++ b/drivers/acpi/utils.c > @@ -725,8 +725,6 @@ bool acpi_dev_found(const char *hid) > EXPORT_SYMBOL(acpi_dev_found); > > struct acpi_dev_match_info { > - const char *dev_name; > - struct acpi_device *adev; > struct acpi_device_id hid[2]; > const char *uid; > s64 hrv; > @@ -746,9 +744,6 @@ static int acpi_dev_match_cb(struct device *dev, void *data) > strcmp(adev->pnp.unique_id, match->uid))) > return 0; > > - match->dev_name = acpi_dev_name(adev); > - match->adev = adev; > - > if (match->hrv == -1) > return 1; > > @@ -818,7 +813,7 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) > match.hrv = hrv; > > dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); > - return dev ? match.adev : NULL; > + return dev ? to_acpi_device(dev) : NULL; > } > EXPORT_SYMBOL(acpi_dev_get_first_match_dev); > > -- > 2.7.4 >