From patchwork Fri Jun 14 17:53:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 166878 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2352420ilk; Fri, 14 Jun 2019 10:54:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAAWktsI7HCI/awDq/kclJnA46e4XujSJ6WYgx+iOgXLrifOpylppma6IGsLhha1TRyCjZ X-Received: by 2002:a17:902:e287:: with SMTP id cf7mr4102819plb.32.1560534890951; Fri, 14 Jun 2019 10:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560534890; cv=none; d=google.com; s=arc-20160816; b=Q9Syw3jPm2GJ+v7IIO+BEMYbBadLGpjrkjVZGfrPvz5Pnakjqx296mLLP/soZQgXOg 651Z2GA4NsOYdoxtaKjogq21PqpIfGHfmsGS35k4zYzPqmdvKM9UmQxu8Gi5EjK5E305 TPfEWit1qrflXQ+rO1ANdFxJ4sYWh1b3ObaKdzhzyKr4lIFzPEel5uxel6telUDTL9A9 IBMR09BGLfkk66CM5BfcBcCjiZ2iy0+KHk7iCBkiXFGVxZrQIlu+Kws/thjn8F1vaVcm SBzYlK8YZgSylUT5ivtWSY6sHg+wvBLOC3dsKmjk4Lc01vBbJfxiQFMlGllNzq8BJBH+ LLSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=2d2uoc8PSgh1CvJ71yDUNE63rXRq5HHVU6DU93Iva5s=; b=jYwT21EzmRwTCt4xqLS26InJ11BgnYIp0ljFPVYhFymdxs8oSZ46dzWYdPXu5ldLy1 UbofTqq4L4/sBMcDObUZMonOephEWUr+YS0S2g7yvFOU6xBPRSwSsYNY4Jjt2xGKNDiy i/yuV8DNHInK3TRKs6mv1MYY+X+52CkMsFAF9xP7UIrWKMsbSP9ITqqLyBWZxMeiNLsM aANWFxby3buznWWYGIkctMba5XZBg4SvtqNr3e5b4zDLzmJmoxti2weVze9E0e/Ztx3b M5Dk4L3VQW2rrU07lYLGCoYwAeRgZaNGZSbjOwHZmzkM7drgYwyRyD7qNGEmVOFNLvZQ 7qBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s18si2804363plp.128.2019.06.14.10.54.50; Fri, 14 Jun 2019 10:54:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727179AbfFNRys (ORCPT + 9 others); Fri, 14 Jun 2019 13:54:48 -0400 Received: from foss.arm.com ([217.140.110.172]:39262 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727204AbfFNRyr (ORCPT ); Fri, 14 Jun 2019 13:54:47 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1A41D3EF; Fri, 14 Jun 2019 10:54:47 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 327DB3F718; Fri, 14 Jun 2019 10:54:46 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Len Brown , linux-acpi@vger.kernel.org Subject: [PATCH v2 03/28] acpi: utils: Cleanup acpi_dev_match_cb Date: Fri, 14 Jun 2019 18:53:58 +0100 Message-Id: <1560534863-15115-4-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com> References: <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- drivers/acpi/utils.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 Reviewed-by: Rafael J. Wysocki 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);