Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp665885imm; Thu, 6 Sep 2018 08:17:51 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb1p5RbzqpDPYzEO/ozxUZkY2P9/SaBN/OnypLtVRX31JpkrelEZserEuVv6z0DRtDQ0R1s X-Received: by 2002:a63:2605:: with SMTP id m5-v6mr3125956pgm.225.1536247071274; Thu, 06 Sep 2018 08:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536247071; cv=none; d=google.com; s=arc-20160816; b=rjJ/HmHBcM1mL3ewP0SZYaRyCa8jeS55GomPl2hk24WAvWAL+5UeeJeDWHnYfQY79l DAnZvD/NkYlOfIM28AEayui5dArsJ1J6icoHuhgwD6/qSShAfMpdTbFhIPMQbLN57YNy xeQz2H4EnNp+upUSgBmS1QmL79k+TYrotJAsfcIaFGnV/4JBzyEXncTSksrihnco6Ohv g7vj8eur8uQreh+O8lUtxRJHNigyBuQD3vfY8jTOHq5Rcy8umqg08fHqSUetLadcxvqW pgawl3MIXkasVcYyMAb7PPCp0G4UQArO3WhgaUsZVAuKfIuMojRreb4cXSCX45kcXgt9 X6Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=CNqXa2J92ZLcEblFYl7t4SARRWrB8lQSYgfT+dH2wW0=; b=HV58usKs8pkBeuqqpSdW0UUYevRuA6T4fUzvjmO0tUCU3H2vVCYC75PkCwRD7Rhnus 7pjGmMkoUDeadtYnyr1DWLnyxZUeddArAquOm222/gjTEm/rHUlws57szfpsel7noyXA rsjnNCJOmEJAoyjkWFqjviBaa95AYN6ILQRLlpcRwuK/9MxzBZe1zugQKeKqc3QikdyS YRi6GtH9bOnS8aH+XNC/SVaGU8rPzCzpfdb1CmaeV4SdW9WQGa9SkLAweQGEeSK4ajBv 3qKnKS9zz0mFea3RiDduOJ1Hk8NPwwzG4hl0whXU1Oyr0gi08P08K39H/jXlW04GZ/bg RG2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2-v6si5700639pgg.83.2018.09.06.08.17.34; Thu, 06 Sep 2018 08:17:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730290AbeIFTvd (ORCPT + 99 others); Thu, 6 Sep 2018 15:51:33 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:41310 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730048AbeIFTvc (ORCPT ); Thu, 6 Sep 2018 15:51:32 -0400 Received: by mail-qt0-f194.google.com with SMTP id t39-v6so12647178qtc.8; Thu, 06 Sep 2018 08:15:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CNqXa2J92ZLcEblFYl7t4SARRWrB8lQSYgfT+dH2wW0=; b=NX+EEMpR8M0wGKTj2wQaMrGEjQI/l4ye76aq2DRzi9TWquFn42ga4GFTHFitd0QfmK pAn9pkmQNLST1aye3PENhtjPWnvyo0qy1BlkHi44bEGVmOXERtwYKx5l+N9tv//VNxOU DzV0gWlnDyFwtinhhj5PROdDRftPJ9dEPBX96Ek2PQQ3P3Z3nyADvpIQ7d+9g3qWrygW +Tsu3qYeD/4GBjusB+Kx6tqTKhMHR1lDTfZ4275tMbmCF9IdHRs+G08FNsNqkKOTbxGb 1mi3jfsA6XBLVcmDP8OymvKAlwjXIJHxKYywckf7vPqqGySRo70h9HKJ+Iz1mQC5T/gs yoig== X-Gm-Message-State: APzg51AM0o/hbNiTSawBg6LfaiOf89mkYMPgCQidT8ec3SpVtcxdIatE Zn+TJF/4KmI/sgTB/XTw2ZvrGkjPvIgh2HIAVMY= X-Received: by 2002:ac8:6959:: with SMTP id n25-v6mr2584415qtr.9.1536246932739; Thu, 06 Sep 2018 08:15:32 -0700 (PDT) MIME-Version: 1.0 References: <20180905154108.20770-1-boris.brezillon@bootlin.com> <20180905154108.20770-2-boris.brezillon@bootlin.com> <20180906160048.2f585e2b@bbrezillon> In-Reply-To: <20180906160048.2f585e2b@bbrezillon> From: Arnd Bergmann Date: Thu, 6 Sep 2018 17:15:16 +0200 Message-ID: Subject: Re: [PATCH v7 01/10] i3c: Add core I3C infrastructure To: Boris Brezillon Cc: Wolfram Sang , Linux I2C , gregkh , Jonathan Corbet , "open list:DOCUMENTATION" , Przemyslaw Sroka , Arkadiusz Golec , Alan Douglas , Bartosz Folta , Damian Kos , Alicja Jurasik-Urbaniak , Cyprian Wronka , Suresh Punnoose , Rafal Ciepiela , Thomas Petazzoni , Nishanth Menon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , DTML , Linux Kernel Mailing List , Vitor Soares , Geert Uytterhoeven , Linus Walleij , Xiang Lin , "open list:GPIO SUBSYSTEM" , Sekhar Nori , Przemyslaw Gaj , Peter Rosin , mshettel@codeaurora.org, swboyd@chromium.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 6, 2018 at 4:01 PM Boris Brezillon wrote: > On Thu, 6 Sep 2018 15:38:49 +0200 Arnd Bergmann wrote: > > On Wed, Sep 5, 2018 at 5:41 PM Boris Brezillon wrote: > > > > > +struct i3c_bus *i3c_bus_create(struct i3c_master_controller *master) > > > +{ > > > + struct i3c_bus *i3cbus; > > > + int ret; > > > + > > > + i3cbus = kzalloc(sizeof(*i3cbus), GFP_KERNEL); > > > + if (!i3cbus) > > > + return ERR_PTR(-ENOMEM); > > > > I find it a bit confusing to have separate i3c_master_controller > > and i3c_bus structures with this version. Why not merge the > > two structures into one now and move the bus management > > into master.c? > > Yes, I considered this approach. Not sure it would make the whole code a > lot simpler though, and it was definitely more work on my side, so I > decided to delay that and wait for someone to explicitly request this > change ;-). > > I also like the bus/master separation in that it allows one to clearly > identify the properties that are bus (speed, mode, ...) related and > those that are master controller oriented (PID, DCR, ...). Maybe you could make the bus a member of the master rather than a pointer from it? That would still let us avoid the separate dynamic allocations, and not having to worry about separate lifetime rules for the two, but also group the bus properties together a bit more as you said. It can also have code deal with the the bus object without including the structure definition of the master (if that is desirable). > > Since it contains an i2c_adapter, maybe a good name for the > > combined i3c_master_controller+i3c_bus structure would > > be 'i3c_adapter'? > > Hm, I'd really like to keep the name master and not adapter, just > because that's how it's named in the spec. Fair enough. > We don't store i3c/i3c_device objects in those lists, but > i3c/i2c_dev_desc objects, so device_for_each_child() won't work. > Remember that i3c devs can be present but not registered yet, and we > need to have those representations somehow attached to the master/bus. Ah right, I remember you explained that before. > Regarding the possibility of merging those 2 lists together, we could > do it, but I find it simpler to have them separated. Agreed. It would only make sense if we had the combined list already. > > That might help with locking > > and keeping the two lists synchronized, which may or > > may not be a problem here. > > Regarding the locking aspects. Anything touching those lists is either > init code (which should be serialized) or DAA related, which requires > the bus lock to be held in write mode (exclusive access mode). Do you > see any other possible race? No, nothing specific, it was just a general feeling. Arnd