Message ID | 20231121-dev-iio-backend-v1-1-6a3d542eba35@analog.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp520766vqb; Tue, 21 Nov 2023 02:18:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEb5Zx9E5sj9iMWXqWHP2udD488XIkwKBDJM8sthR9+gUiZmHsmCva6O1fjp35gDT08RZMl X-Received: by 2002:a05:6870:7022:b0:1f9:6971:12da with SMTP id u34-20020a056870702200b001f9697112damr1697033oae.0.1700561913492; Tue, 21 Nov 2023 02:18:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700561913; cv=none; d=google.com; s=arc-20160816; b=BJP5A15IXLpmAlWswREwKHQThDeJUO/lZXYN9fDs78TuTUkkF8WfmznIrEmOFGTJmU g/G4Od/Dvd2RNJ21vK6gXkyH6zWRw5xBtjtUnT7NGDrMlJbKtvG1qvA8RBlIxDl9Q3ck tBqIqCmxVe4x9PveV3dkwEfw1xZgMaE4FC7aMv+T3ZUAkvY9iy1yeTUUkoR4i7O4jOTs 5aGHCeBGXS8W1jaUkvsPHZ7N4qT0C2CblXIHRVa+9skNHteETRfYQr4UDkEVx3kW/MdQ DBwaNNqmr1Hzy/BMP9nnuID3YaCAmBDSBHkb7hazZskD4m+16my0mW4QNd9+vuJHZB8C YfPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=QohbLY7dW7q8BFzzSmrXneV14IW6RxwyVViKdDgmhCE=; fh=phDggtdq/mZScnogaJFJfeRDE2XPpZpUuxL35p15uks=; b=0X/RKJhr/KU8QSWsB7piqGPVRAFtrceM0rSWjkNrSA73/JDQeOePpIIqPyqVePg5BZ E6MVNhTxkVkQNLsBIxmsDAAJ+xAmnbQHyKAMMkt4zXRJ6OAmfyen13k2Zu0jkw4cJK7b KX7HGbxrjR6gusv6eEYxffaENG3V0wRnaYE0aM5LI4dSBcy71uFjzwkj9r0Inv7H7exy L3pGUZ6oolcd208KTuYMB2AL+OpRvBEAPae1ZNG1RWwR7brLuOBHGzAepsjTpqSVu7hg RXZ9CvebFrRpFFLmZINxwlu39+p+tfye8p/YAIJB8/JcKgrzVa5JDYVOYv0x0gG5dg42 fjOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oib2XK8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cm11-20020a056a020a0b00b005aaefc07ccfsi10340102pgb.36.2023.11.21.02.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:18:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oib2XK8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7808D8068942; Tue, 21 Nov 2023 02:17:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233228AbjKUKR1 (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Tue, 21 Nov 2023 05:17:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230304AbjKUKRX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 21 Nov 2023 05:17:23 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAC3111C for <linux-kernel@vger.kernel.org>; Tue, 21 Nov 2023 02:17:19 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPS id 36C59C43391; Tue, 21 Nov 2023 10:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700561839; bh=xcCsv1YPXfjaIvVA0RXUQOLchG7pC7TZTbb7h2QT8FQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=oib2XK8eT+qBW/Nr472d/IyFjTfOHjRVg/9rYs7HMIkW6pLg/cMh1Mms2cGzbeyBm 3XwDVwIpdyYzPypAuS8/xiVeIDZA2KuJdGCU3vmoTvScbRvA1DEAtASwslpoW2HM0J 8k3dkcr0Vfl3SpneSmJg2avw0/cCj3BOSf0+55vLCfwvKO+sz+syiKp/gXFdtYob7S HsMmMdq2yS7GUtPdjdIfNXlxQSkzB008yQHlPcf12GKFSE6KHPEa5VYs6I5fncph7D DeHBHF+f1wTRjMq3/QxweB/k/8rAoHKdv/zrfCBMN+7s7/xaHqwvuUUwQ8dXiLxNDy TUDoQuRHZ1IZw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EFB9C61D88; Tue, 21 Nov 2023 10:17:19 +0000 (UTC) From: Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org> Date: Tue, 21 Nov 2023 11:20:14 +0100 Subject: [PATCH 01/12] driver: core: allow modifying device_links flags MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231121-dev-iio-backend-v1-1-6a3d542eba35@analog.com> References: <20231121-dev-iio-backend-v1-0-6a3d542eba35@analog.com> In-Reply-To: <20231121-dev-iio-backend-v1-0-6a3d542eba35@analog.com> To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org Cc: Olivier MOYSAN <olivier.moysan@foss.st.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>, Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Michael Hennerich <Michael.Hennerich@analog.com>, Nuno Sa <nuno.sa@analog.com> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1700562016; l=1762; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=E5lJx+ba9aYfbW1751Y9ldC8MoJ9UmaBt8xD72NDIH4=; b=26RR5dmwuMuNTNSHOSrKzhJ9h6kRHuIupD5eZcLuJVFt7ycciyqPzBZYIEC4VKVNAvVs81nSY 9h5AiMe0tyIBb/3LpfBAVNjBvpsPsIPVhI3Nrk+IXGAEEGFn+7cKzt7 X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa <nuno.sa@analog.com> Reply-To: <nuno.sa@analog.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 02:17:32 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783168409199143841 X-GMAIL-MSGID: 1783168409199143841 |
Series |
iio: add new backend framework
|
|
Commit Message
Nuno Sa via B4 Relay
Nov. 21, 2023, 10:20 a.m. UTC
From: Nuno Sa <nuno.sa@analog.com> If a device_link is previously created (eg: via fw_devlink_create_devlink()) before the supplier + consumer are both present and bound to their respective drivers, there's no way to set DL_FLAG_AUTOREMOVE_CONSUMER anymore while one can still set DL_FLAG_AUTOREMOVE_SUPPLIER. Hence, rework the flags checks to allow for DL_FLAG_AUTOREMOVE_CONSUMER in the same way DL_FLAG_AUTOREMOVE_SUPPLIER is done. While at it, make sure that we are never left with DL_FLAG_AUTOPROBE_CONSUMER set together with one of DL_FLAG_AUTOREMOVE_CONSUMER or DL_FLAG_AUTOREMOVE_SUPPLIER. Signed-off-by: Nuno Sa <nuno.sa@analog.com> --- drivers/base/core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c index 4d8b315c48a1..b6aac55c361d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -806,11 +806,15 @@ struct device_link *device_link_add(struct device *consumer, * update the existing link to stay around longer. */ if (flags & DL_FLAG_AUTOREMOVE_SUPPLIER) { - if (link->flags & DL_FLAG_AUTOREMOVE_CONSUMER) { - link->flags &= ~DL_FLAG_AUTOREMOVE_CONSUMER; - link->flags |= DL_FLAG_AUTOREMOVE_SUPPLIER; - } - } else if (!(flags & DL_FLAG_AUTOREMOVE_CONSUMER)) { + link->flags &= ~DL_FLAG_AUTOREMOVE_CONSUMER; + link->flags &= ~DL_FLAG_AUTOPROBE_CONSUMER; + link->flags |= DL_FLAG_AUTOREMOVE_SUPPLIER; + + } else if (flags & DL_FLAG_AUTOREMOVE_CONSUMER) { + link->flags &= ~DL_FLAG_AUTOREMOVE_SUPPLIER; + link->flags &= ~DL_FLAG_AUTOPROBE_CONSUMER; + link->flags |= DL_FLAG_AUTOREMOVE_CONSUMER; + } else { link->flags &= ~(DL_FLAG_AUTOREMOVE_CONSUMER | DL_FLAG_AUTOREMOVE_SUPPLIER); }