From nobody Tue Dec 2 02:52:28 2025 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E1D626A1BB for ; Mon, 17 Nov 2025 15:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763394036; cv=none; b=F2mcX6FztYTcMWuRh9j9JuevADAW61kRuRgOiD71Csg7X71PGiCDyQJwc8C0hIekBN+iSz2zT48HN8UEQ1bx0bf2JHae+1hNt2XN3NrZaw7UQExR1R9RyRvh3egsVU/2RZY/C7GU16NjtAANFjN4wug/IZVpcbGcvCsfxfBziOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763394036; c=relaxed/simple; bh=xFaDCvUsJd54TZ0WaCbhSskCQDAna0uFN7gbINeI5kI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pQ+n+zdTmvc5rj9GJdYuXvmCy/DBrjI42a/yyeTjZWF1IkNUXE9fB0CqfE9nzDJ/VAOk81seJXy4ARUDRSL/yz9YIWvW1QgClApIU0Z81Ywzh0xL8kaphUMdVU2MXwIchiFo8o+qghxe5K+9JjoPOoc3EGHqB5mW/4BP3Ez/C70= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Tl4LK0cF; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Tl4LK0cF" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-37bbb36c990so13161101fa.0 for ; Mon, 17 Nov 2025 07:40:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763394033; x=1763998833; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y8m3HlyrN5G4quF+h5Be5C2aANnXlah0e9ocbfNWGyk=; b=Tl4LK0cFgk7l4dA+7KWhpqAkPrl74jBf/48AQSNai8gx+76o9Wgssgltsn8MamlHgZ aHXezHblBMqSVeTrunHJXwMwQTa5GmvmieTXRvMGEiPuOrILPlV29VQ09eQjLt5jx+hv CK7WClLQApri4OA8rQ1r4aUw1GWb39J4jvWJ1yRyc6giVNWnwZAiTNLw1KhsdhhLq2Cw v76AhDviM42dkW9GmNDcjwYSpQWqTbnMucWbcit/6pqJMIhrJevHmFgQqWsZHwMzaKBW DD3dGkc1hJ3wYU8zaAGpjmMxKLb4hzKMLrGm2mX20EsCtQlDnzFgCcw5YLwY26a6qcFp eBpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763394033; x=1763998833; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y8m3HlyrN5G4quF+h5Be5C2aANnXlah0e9ocbfNWGyk=; b=czo6h+qZ0+iA1CIM+H8UrlLPj47gPQ83iqqL6ho7WxWjSqVuNAQ2ZJ4YzdXKHvmlZd I4eDlkU2oJIhR5mShELkmVix2DeXohUzAm20rtFIvOWkukU4pu9e7aiTLk8bIvH4d/ih aStGIzZE4HYxkemDdD9n/HA44biFz55TVTxXt6AF5HUd5u2kcF+5j2pnmTB62llmUtv4 8IITqVRRro9Czax+SLuJ5MYK7m5DOPPnmzfv4C/6nsJINJbx1Jd8h78XrwwTroZH+HBl +s3hQ5/hsHgAlLbt/eacd4Cb4N8KAzJ0SMPjRjQJX56IXmxCQGe4eN5XrTbkA4HA9R2s z8ow== X-Forwarded-Encrypted: i=1; AJvYcCUN37a9Py/K1FUCPo1ymjr8pvsGdSmE+TMp3poLjT13gXzlmLa7d6tQkWfAfgssl18z9PGQSwUdUhQNOPY=@vger.kernel.org X-Gm-Message-State: AOJu0Yzdn+lRq6AEkuNswqIKa2t2+3Sw2rdwMeiWXgC4EWxn6JViXNXf FdwZiG83p0fsUD5KyV3VuMbZ0N8N0ZdSsStLQ9dYYUilpqftAYGJvUVz X-Gm-Gg: ASbGnctvpZhyAxvCjAHQxaVseUaMeBBul5Y9xPYQXwDbOMcd85CzVtnR2BEeGGkGHJt WPpnJKYecIFDMLwsvZYdxtcigLKllUr9vbrLXVGFMnITb8zTuCphL4K4CkiESGx/YGjrPtT8VQg qB7HvWIDXAuMb/AD09K6De9Ruhkv4aK1N+VN4a7LnkBnkXNaFDXrdlAQQt1QfxBpl2bp6yxkLz5 +NmWr6MmmKbT/SvEmk2AI3t/bNpmVVzbgtouXF/yTiO/fZ9aiaH34Mz/fUvsBkMcR7ulesEY2V6 KVHQ2V8bEyycDIFfW4digZUedxubQTqW0gsHoLCu1wvgzHZCtXA5b6LpIpl5wu9EJURmBR4zEmA xIcULEYFHqYQsQ8tNttVJ7UgpRKbSafB01Iy3yAgQ3HMsVpzjjIVm7ie2+LugHNbGcwugWGzaAH o33eyF/6P4t60xVHocLf/KRaxub48= X-Google-Smtp-Source: AGHT+IGFtJH8VsFe+GacyhFN34helqWgXi1KC0HllPayVzkXwGvIHNqbmP8atDFCHXtLCqL1wBfeDQ== X-Received: by 2002:a05:651c:1541:b0:356:ce66:d30a with SMTP id 38308e7fff4ca-37b9af72a82mr44330961fa.2.1763394032188; Mon, 17 Nov 2025 07:40:32 -0800 (PST) Received: from NB-6746.corp.yadro.com ([188.243.183.84]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-37b9ce15471sm28435811fa.12.2025.11.17.07.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Nov 2025 07:40:31 -0800 (PST) From: Artem Shimko To: gregkh@linuxfoundation.org, lee.jones@linaro.org, Philipp Zabel Cc: Artem Shimko , linux-kernel@vger.kernel.org Subject: [PATCH] reset: add of_reset_control_get_optional_shared() helper Date: Mon, 17 Nov 2025 18:40:26 +0300 Message-ID: <20251117154027.3708807-1-a.shimko.dev@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a new reset control helper function to support shared optional reset lines in device tree. Some hardware platforms have reset controllers that are shared among multiple devices and may not be present in all configurations. Implement of_reset_control_get_optional_shared() by extending the existing reset control framework with RESET_CONTROL_OPTIONAL_SHARED flag handling. The function combines the behaviors of optional and shared reset controls, returning NULL when reset line is not specified and allowing shared access when it exists. Signed-off-by: Artem Shimko --- Hello, In the syscon MFD driver, we use of_reset_control_get_optional_exclusive() to obtain reset control, but due to the characteristics of my board (NDA), I need to use shared instead of exclusive reset control. After testing, everything works correctly with this implementation. Thank you for your consideration. -- Regards, Artem include/linux/reset.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/reset.h b/include/linux/reset.h index 840d75d172f6..5600e2602491 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -547,6 +547,26 @@ static inline struct reset_control *of_reset_control_g= et_shared( return __of_reset_control_get(node, id, 0, RESET_CONTROL_SHARED); } =20 +/** + * of_reset_control_get_optional_shared - Lookup and obtain an optional sh= ared + * reference to a reset controller. + * @node: device to be reset by the controller + * @id: reset line name + * + * Optional variant of of_reset_control_get_shared(). If the requested res= et + * is not specified in the device tree, this function returns NULL instead= of + * an error. + * + * Returns a struct reset_control or IS_ERR() condition containing errno. + * + * Use of id names is optional. + */ +static inline struct reset_control *of_reset_control_get_optional_shared( + struct device_node *node, const char *id) +{ + return __of_reset_control_get(node, id, 0, RESET_CONTROL_OPTIONAL_SHARED); +} + /** * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive * reference to a reset controll= er --=20 2.43.0