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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6464ECDB474 for ; Fri, 20 Oct 2023 15:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8XEeFQjiIaW/Wl9I2YgH4J4rl7Ksg6NPKEgOfN5Y2/c=; b=aswv42mKMFqW+C pNWG6pC6RfT7WaRHR2A6aIuwLZkeoTd1+0wmTa/CmKfQRJiggPVjo9N0UcRdpqUBDSvEwOsaRXnax N/fVoab1h7fgZUXPuljQ1wPVGHnA8lX9beLtoAEKPt4LnxjHSBsuWhWZCBHMd5oAVoscvVRwRiB4X 2AUR6E3ov+e7J2MOphPzwc+HCteVLvhdcjAivly/rCG/zf47cAs+n8mutVLXfR/p1+ePo0Nc3yUUL jW4Su0VEjSWN5rkRWePIeONiMVVoE0Iix+J87zXhLFHem762Y7+l0BJLwvD2JDoMo+Ogl/d81Nigi Ow60ezFNida0kX9BYsxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtrl2-002drU-14; Fri, 20 Oct 2023 15:49:52 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtrkz-002dpm-07 for linux-arm-kernel@lists.infradead.org; Fri, 20 Oct 2023 15:49:51 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SBpsm1khlz67M1H; Fri, 20 Oct 2023 23:49:00 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 20 Oct 2023 16:49:34 +0100 Date: Fri, 20 Oct 2023 16:49:33 +0100 From: Jonathan Cameron To: Raag Jadav CC: , , , , , , , , , , , , , , , Subject: Re: [PATCH v1 1/8] ACPI: utils: Introduce acpi_dev_uid_match() for matching _UID Message-ID: <20231020164933.00002f53@Huawei.com> In-Reply-To: <20231020084732.17130-2-raag.jadav@intel.com> References: <20231020084732.17130-1-raag.jadav@intel.com> <20231020084732.17130-2-raag.jadav@intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_084949_429559_3A6021F0 X-CRM114-Status: GOOD ( 15.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 20 Oct 2023 14:17:25 +0530 Raag Jadav wrote: > Introduce acpi_dev_uid_match() helper that matches the device with > supplied _UID string. > > Suggested-by: Andy Shevchenko > Signed-off-by: Raag Jadav > Reviewed-by: Andy Shevchenko > /** > * acpi_dev_hid_uid_match - Match device by supplied HID and UID > * @adev: ACPI device to match. > * @hid2: Hardware ID of the device. > * @uid2: Unique ID of the device, pass NULL to not check _UID. > * > - * Matches HID and UID in @adev with given @hid2 and @uid2. > - * Returns true if matches. > + * Matches HID and UID in @adev with given @hid2 and @uid2. Absence of @uid2 > + * will be treated as a match. If user wants to validate @uid2, it should be > + * done before calling this function. This behaviour is as needed by most of > + * its current users. If there are other other users that need different behavior are they buggy? Also what behavior is this referring to? I'd just drop the at last sentence as confusing and not adding much. > + * > + * Returns: > + * - %true if matches or @uid2 is NULL. > + * - %false otherwise. > */ > bool acpi_dev_hid_uid_match(struct acpi_device *adev, > const char *hid2, const char *uid2) > { > const char *hid1 = acpi_device_hid(adev); > - const char *uid1 = acpi_device_uid(adev); > > if (strcmp(hid1, hid2)) > return false; > > - if (!uid2) > - return true; > - > - return uid1 && !strcmp(uid1, uid2); > + return acpi_dev_uid_match(adev, uid2); > } > EXPORT_SYMBOL(acpi_dev_hid_uid_match); > > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h > index 254685085c82..d1fe6446ffe0 100644 > --- a/include/acpi/acpi_bus.h > +++ b/include/acpi/acpi_bus.h > @@ -760,6 +760,7 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev) > adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set); > } > > +bool acpi_dev_uid_match(struct acpi_device *adev, const char *uid2); > bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2); > int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer); > > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index afd94c9b8b8a..db3a33e19c97 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -787,6 +787,11 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv) > > struct acpi_device; > > +static inline bool acpi_dev_uid_match(struct acpi_device *adev, const char *uid2) > +{ > + return false; > +} > + > static inline bool > acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2) > { _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel