Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp196767rdb; Thu, 30 Nov 2023 02:13:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGo17XxTANtnMBJEpUF78c+HnrZ4spLKIq3FoZPHj7EKNKMTF9LIOBvai09zLmrSoqmlOAk X-Received: by 2002:a05:6a21:99a5:b0:18a:d5a8:93e3 with SMTP id ve37-20020a056a2199a500b0018ad5a893e3mr21945649pzb.61.1701339223619; Thu, 30 Nov 2023 02:13:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701339223; cv=none; d=google.com; s=arc-20160816; b=KmtewO3feFjDc9iKOgxROucd54CMpXba3gNACb7PFfFrEd6BSNKE41dNVM3ny05CtJ RnOFtt/Jp9qi2axBZTQRf8MptHmdeL6TkFK8PMDuUaEep5FEH6DFQQoNqAa03CL2UBIk iU0Bg4OZ49vJrYUIJFRcaKw99HIzZ5Co50e1ugx2H0wJl2bKRXm75A/k/QSqD92Y5ESS F7bXEPHw/zpEhdBwAGDw1LmyhgIU/51h8dVyGr+bjSq9/QpLFx/Q17t7GrnC4y6RtdcS kQ3OdbVBhwtnVtjEB75LXMAtSytVyqzA9VGmDR65QOzF+8AIKH3XcgNrW3ueQ+NV/ZQR AATg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Eul7P3tvqZcblHVJ8cWvUt7gAONNj5sKxayyAvBmU8s=; fh=wOW34pMltp2/LAnD+YEq9BzyvIgi/oKnPu3e+Unfy8s=; b=rq/TgQgnZg76N4lpvQKIYRTTiOtBBUABwhl/CmdhK6SL9MZGbd2SeaDaDuLTp8bLxM KSEtRhLfHKu1r/63f02O5+bc2XsM6Xp/9fMg2dD3ZDuHULxy3MIcT5stdGt+T7aslo0Y D2qOVpWvxvRF7qZYZWjd3/+2W9sCQsx/Cfax2HLVBHcIteDLakdfojvKsWYNKu2ZqpWz 60sbMDMwUvswEQlhBvbSfHm03N9RR9jzTPUgbQk5fjXelRlzcVVzD/65sVOEBuyLn0QR N0qwee2gFBeidd+GWbiuJxuFfwYogXFZbYHHw2YaSaK559w8xBFI79HS40Wny3PVXN6Z fhbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=R4J9KlNt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id z20-20020a17090ab11400b00262ca5c4c12si1010928pjq.178.2023.11.30.02.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:13:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=R4J9KlNt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 75CC7823B3D6; Thu, 30 Nov 2023 02:13:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbjK3KNX (ORCPT + 99 others); Thu, 30 Nov 2023 05:13:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbjK3KNW (ORCPT ); Thu, 30 Nov 2023 05:13:22 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16DCF10C2 for ; Thu, 30 Nov 2023 02:13:24 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7A12FE0003; Thu, 30 Nov 2023 10:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701339203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eul7P3tvqZcblHVJ8cWvUt7gAONNj5sKxayyAvBmU8s=; b=R4J9KlNtzPHRqq2mNgsahIwLfrF+RlJ0UHUDqd2PRMpNd0s6AeYuxukuY4M1Xvlzo+PT26 ZkasPugB779XCn2A6G5pKSh6plLnPSLHMvR+fIfLicqEzoWW7yLjMHEDp9un4pBs1W1l7O Ob2ZuAs2MPNJKczx7dI/70pX7cvC3tNfSKGWtaJWhLvOKbRem75RnPMHUEDSuPbORCqJQ9 w+MlivkSbtfTXE9aMDx3WL/IYrwQpS01WgzhhXdiAKHlPtWWBYSRsY5jY1jufhXTOQ1KNm DD7+rtVGjNGJN/ln4WZO1D9yb8X+L3hzYEES9kbk1tZ1dE/dMYwziAxxtDjg2Q== Date: Thu, 30 Nov 2023 11:13:21 +0100 From: Miquel Raynal To: Frank Li Cc: alexandre.belloni@bootlin.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, zbigniew.lukwinski@linux.intel.com Subject: Re: [PATCH v4 1/6] i3c: master: add enable(disable) hot join in sys entry Message-ID: <20231130111321.3ce6a961@xps-13> In-Reply-To: <20231129221225.387952-2-Frank.Li@nxp.com> References: <20231129221225.387952-1-Frank.Li@nxp.com> <20231129221225.387952-2-Frank.Li@nxp.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=1.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 30 Nov 2023 02:13:35 -0800 (PST) X-Spam-Level: * Hi Frank, Frank.Li@nxp.com wrote on Wed, 29 Nov 2023 17:12:20 -0500: > Add hotjoin entry in sys file system allow user enable/disable hotjoin > feature. >=20 > Add (*enable(disable)_hotjoin)() to i3c_master_controller_ops. > Add api i3c_master_enable(disable)_hotjoin(); >=20 > Signed-off-by: Frank Li > --- > drivers/i3c/master.c | 84 ++++++++++++++++++++++++++++++++++++++ > include/linux/i3c/master.h | 5 +++ > 2 files changed, 89 insertions(+) >=20 > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c > index 08aeb69a78003..ed5e27cd20811 100644 > --- a/drivers/i3c/master.c > +++ b/drivers/i3c/master.c > @@ -526,6 +526,89 @@ static ssize_t i2c_scl_frequency_show(struct device = *dev, > } > static DEVICE_ATTR_RO(i2c_scl_frequency); > =20 > +static int i3c_set_hotjoin(struct i3c_master_controller *master, bool en= able) > +{ > + int ret; > + > + if (!master || > + !master->ops || > + !master->ops->enable_hotjoin || > + !master->ops->disable_hotjoin > + ) Style is wrong here (max limit is 100 chars and the ) should not be on a new line) > + return -EINVAL; > + > + i3c_bus_normaluse_lock(&master->bus); > + > + if (enable) > + ret =3D master->ops->enable_hotjoin(master); > + else > + ret =3D master->ops->disable_hotjoin(master); > + > + master->hotjoin =3D enable; > + > + i3c_bus_normaluse_unlock(&master->bus); > + > + return ret; > +} > + > +static ssize_t hotjoin_store(struct device *dev, struct device_attribute= *attr, > + const char *buf, size_t count) > +{ > + struct i3c_bus *i3cbus =3D dev_to_i3cbus(dev); > + int ret; > + long res; > + > + if (!i3cbus->cur_master) > + return -EINVAL; > + > + if (kstrtol(buf, 10, &res)) > + return -EINVAL; Isn't there a better approach to get a y/n answer in sysfs? > + > + ret =3D i3c_set_hotjoin(i3cbus->cur_master->common.master, !!res); > + if (ret) > + return ret; > + > + return count; > +} > + Thanks, Miqu=C3=A8l