Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5134583pxj; Wed, 9 Jun 2021 09:55:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzttyfVSdqbpazV46on91174GQQX3wGuBVAk3AGJ/Uc1qlFJr88T3nHvDlFTca9V13OFEGm X-Received: by 2002:a05:6402:175b:: with SMTP id v27mr382563edx.61.1623257737541; Wed, 09 Jun 2021 09:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623257737; cv=none; d=google.com; s=arc-20160816; b=y5YQsxbK8z2emOOnrjYAdSObu6h+90jyU9wvs7+3s63264VPvLg7mU21St95jxr/9O jy0ICQxWUA8fKChPVhrVcqsxa3TeoxTYNR1qqpRINxgQimJohcTeInrZOQqpWxbdSYQs SJJuxV+TG8J2xgUN1yk/XrQ1exc3Bqc1rHDfxub99Dv/oQoF/DK0VIsDUgF10WxVUAhu F/aFnc9d0kO8MXbYJma6FGqCg7M1U54yR+7jp1gkS/JBNVf3W+G4lP4IxI+eQATs4tYZ s5qS3i0+TzpUb5hylmYYbY9oMA+M+zhmSPxzl8VlhjyCGH0sfHQYkxWL+fjWFdtCS1W+ i+CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=caZmZCA18V3WWapkoNG0952rBooLaITgur4IKbP02YY=; b=vxMuugelfs+6Q6p/d5VGndQbiYkaAqFAxyyH3yxvb0YB5HBthF7Zmt7Vv5zFqH7wlA E4Ns63s8mfWdm3s1di2odABkg1vlDKybrVC/lFxl8MrVt1uzyz+toDuUSk3xV7Wr87lw 1sfvuKDrYmMLC3Ckw7cHRafrmOxSaDyRvGpnXTjvqUzreTzuc9RM2bDtuo6qrVmUBELT pLo35sXZmM2axKGOYY1w8apQvQYkt/pYwlW9d4+QNSDP8fDkmxqBYarQeUWgKhwBfz8x JIXXngYsZrlTxZF4+RTEqHnyxfuLgs7BCuhHs5w00IYzV7LRt8cTpg2vem5tUVYsCy6C h9vQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t6si253577eju.144.2021.06.09.09.55.13; Wed, 09 Jun 2021 09:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234927AbhFHXf2 (ORCPT + 99 others); Tue, 8 Jun 2021 19:35:28 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:56497 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234770AbhFHXf1 (ORCPT ); Tue, 8 Jun 2021 19:35:27 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 77F6E20002; Tue, 8 Jun 2021 23:33:27 +0000 (UTC) Date: Wed, 9 Jun 2021 01:33:26 +0200 From: Alexandre Belloni To: Parshuram Thombare Cc: slongerbeam@gmail.com, vitor.soares@synopsys.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, mparab@cadence.com, praneeth@ti.com Subject: Re: [PATCH v10 6/7] i3c: master: sysfs key for acquire bus Message-ID: References: <1606716983-3645-1-git-send-email-pthombar@cadence.com> <1606717202-4206-1-git-send-email-pthombar@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1606717202-4206-1-git-send-email-pthombar@cadence.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/11/2020 07:20:02+0100, Parshuram Thombare wrote: > Added support to acquire I3C bus through sysfs interface. > > Signed-off-by: Parshuram Thombare > --- > drivers/i3c/master.c | 18 ++++++++++++++++++ > 1 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c > index c01ba00..beb7495 100644 > --- a/drivers/i3c/master.c > +++ b/drivers/i3c/master.c > @@ -581,6 +581,23 @@ static ssize_t i2c_scl_frequency_show(struct device *dev, > } > static DEVICE_ATTR_RO(i2c_scl_frequency); > > +static ssize_t i3c_acquire_bus_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + struct i3c_master_controller *master = dev_to_i3cmaster(dev); > + int ret; > + > + i3c_bus_normaluse_lock(&master->bus); > + ret = i3c_master_acquire_bus(master); > + i3c_bus_normaluse_unlock(&master->bus); > + if (!ret) > + i3c_master_enable_mr_events(master); > + > + return ret ?: count; > +} > +static DEVICE_ATTR_WO(i3c_acquire_bus); > + I'm wondering whether we should allow userspace to actually control that. Shouldn't we simply request mastership when a driver needs to talk to a device on the bus? Is it really useful to have that until there is an i3c-dev userspace interface? > static struct attribute *i3c_masterdev_attrs[] = { > &dev_attr_mode.attr, > &dev_attr_current_master.attr, > @@ -591,6 +608,7 @@ static ssize_t i2c_scl_frequency_show(struct device *dev, > &dev_attr_pid.attr, > &dev_attr_dynamic_address.attr, > &dev_attr_hdrcap.attr, > + &dev_attr_i3c_acquire_bus.attr, > NULL, > }; > ATTRIBUTE_GROUPS(i3c_masterdev); > -- > 1.7.1 > -- Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com