Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4953297imm; Wed, 30 May 2018 15:44:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJoiR0BMwwAjPpJqIvECiwvh0F37JzTCAwN3MVbPy1LuYDbNhYQa+XDFWjbWyymzeXV9qGm X-Received: by 2002:a63:7b1e:: with SMTP id w30-v6mr3570866pgc.249.1527720247549; Wed, 30 May 2018 15:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527720247; cv=none; d=google.com; s=arc-20160816; b=D8LJIFVnuUkdIgPJGlPztgnQ4qO76asTDHFlepzexfC4MtOEDhrjtckscy8P/kMmSA bfyiRkbWM0JEdONWmj0t/lbNt0vlcA6DVxowi7nOJhDLuN3ETs17TvAFQcf1/QBbAT9t 8mxVuS7ecMbJqXTTor7jpHtrR1FCJ/epe/8chYtFIAz/C8Kwh8RQyZrtpxkBfh6mWkrX n4Dkn6gKq9wbljQkPFEywerCdvI0fCLxAMl2wXvxEIO5o5O3vf+JpKUts6Zks7qHJF0b lYhYHqB9YaFMs6juQ0lWlaRp/+ez7wW1fSEjAH1JP43bqLcBkXYU7zA3glgMDeXs6wpo iA/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=PwXVHk+eJRwtaxZgOmK57421nv94KKhvpAwaFa2vK6o=; b=lEw6DkMR6KZxsHcL0zF6Xe7ksrqKmUDKaFTpriP5IN4ihwmY2hOPvN+TN6fdZ6tCue 8arzmxJjuqHQRRfF4b2jQl3FaXZTPBqRT3geSeHZxYyluGCfgiUVKOu+jYQZ+SgMhwln w25hTHA1RrUXt74TgfsjuxoX1yuiAaVc2LI3+r2zRjGpF259NfJwh4Bx+TDJXK7yGTYL nDv3ilN1XEk1z9U/jlCZT+MgB1QHjhTh5/niHRJIgMDEdS1rg1QABqYC4uGdkAA4mCFl B/X7hCZoTiI6Kcd6NL81LzqSmn12zOZtoPngdSohzzCTVjjxDbwCX7scEwn0FsCr0zSY AmbA== 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 g3-v6si22309639pgr.291.2018.05.30.15.43.53; Wed, 30 May 2018 15:44:07 -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 S932623AbeE3Wmv (ORCPT + 99 others); Wed, 30 May 2018 18:42:51 -0400 Received: from gate.crashing.org ([63.228.1.57]:45445 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932289AbeE3Wmr (ORCPT ); Wed, 30 May 2018 18:42:47 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w4UMg46u031363; Wed, 30 May 2018 17:42:05 -0500 Message-ID: <58c1059a91b93a490a7fc8bda2112e67e6513840.camel@kernel.crashing.org> Subject: Re: [PATCH v8 0/7] i2c: Add FSI-attached I2C master algorithm From: Benjamin Herrenschmidt To: Andy Shevchenko , Eddie James Cc: linux-i2c , Linux Kernel Mailing List , devicetree , Wolfram Sang , Rob Herring , Joel Stanley , Mark Rutland , Greg Kroah-Hartman , Randy Dunlap Date: Thu, 31 May 2018 08:42:04 +1000 In-Reply-To: References: <1527714464-8642-1-git-send-email-eajames@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1 (3.28.1-2.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-05-31 at 00:31 +0300, Andy Shevchenko wrote: > On Thu, May 31, 2018 at 12:07 AM, Eddie James > wrote: > > This series adds an algorithm for an I2C master physically located on an FSI > > slave device. The I2C master has multiple ports, each of which may be connected > > to an I2C slave. Access to the I2C master registers is achieved over FSI bus. > > > > Due to the multi-port nature of the I2C master, the driver instantiates a new > > I2C adapter for each port connected to a slave. The connected ports should be > > defined in the device tree under the I2C master device. > > I'll comment the series later, though you have to address previous > comments first: > - understand devm_ purpose and how it works I think it is perfectly understood and I don't see what your problem here is. So please be a proper civil human being an express your concern precisely rather than with aggressive comments. Now to clarify that specific point, devm purpose is to automatically clean up the resources used by the device when it is torn down. However, in this specific case, it makes sense to dispose of the port structure explicitly because this is a failure in registering an individual port which doesn't lead to a failure of the entire driver. Thus not freeing it means the structure would remain allocated uselessly until the whole driver is torn down. > - understand list_for_each*() macros This is a genuine misunderstanding of Eddies, I'm sure he will address it, your tone however isn't appropriate. > - discuss with maintainer a design of enumerating ports I've been at that game for at least a good 2 decades. Maintainers generally do *not* discuss design until a patch is proposed. I even still try every now and then, maintainers are like lawyers, they don't want to tell you what to do in case they still want to reject it after seeing it later :-) I know I've been one of them for long enough. If you have specific issues with how this is done, please express them clearly. It's quite possible that there's some better way to do what Eddie is doing here, but without *construtive* feedback this is pointless. > - ... (whatever I forgot and others added) ... I believe he addressed most of your comments. There is one mistake left (the list_for_each) which will be easily fixed. As for the rest, it's just ramblings unless you or Wolfram can propose a better alternative in which case I'm sure Eddie will be happy to implement it. I'm disappointed here because we have an example of somebody rather new producing what is overall pretty damn good code, despite a few corner issues, and being (again) treated like crap. This isn't the right way to operate, and I believe this has been made clear many times before. Cheers, Ben. > > Changes since v7 > > - Fix grammer in Kconfig (a -> an) > > - Change I2C registers to use BIT and GENMASK > > - Remove custom macros and use FIELD_PREP and FIELD_GET > > - Fix a few unecessary initializations and "return rc" that are always zero > > - Clean up the read/write fifo functions a bit > > - Few other clean-up items > > > > Changes since v6 > > - Remove spinlock for reset functionality; it's unecessary and doesn't work > > with the latest FSI core. > > - Use a mutex instead of a semaphore, and don't wait for timeout to get the > > lock. > > - Use usleeps instead of schedule_timeout; it's not worth the overhead when > > the wait should be very short in between sending the command and receiving > > the response. > > > > Changes since v5 > > - Fix reset functionality and do a reset after every transfer failure > > > > Eddie James (7): > > dt-bindings: i2c: Add FSI-attached I2C master dt binding documentation > > i2c: Add FSI-attached I2C master algorithm > > i2c: fsi: Add port structures > > i2c: fsi: Add abort and hardware reset procedures > > i2c: fsi: Add transfer implementation > > i2c: fsi: Add I2C master locking > > i2c: fsi: Add bus recovery > > > > Documentation/devicetree/bindings/i2c/i2c-fsi.txt | 40 ++ > > drivers/i2c/busses/Kconfig | 11 + > > drivers/i2c/busses/Makefile | 1 + > > drivers/i2c/busses/i2c-fsi.c | 722 ++++++++++++++++++++++ > > 4 files changed, 774 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/i2c/i2c-fsi.txt > > create mode 100644 drivers/i2c/busses/i2c-fsi.c > > > > -- > > 1.8.3.1 > > > > >