Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6479540ybi; Wed, 5 Jun 2019 01:27:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLhkU+DGEbpQl7hCYuQMZeg7iYHpUST0BPb2gepi6Ya0eyfZ15wAozv54Echkc2gm64TVp X-Received: by 2002:a62:b40a:: with SMTP id h10mr44764614pfn.216.1559723239120; Wed, 05 Jun 2019 01:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559723239; cv=none; d=google.com; s=arc-20160816; b=KIC6KXuBpap7Yz+vIunhxrlvW7WMgve3jcrICkl5YuiNuhwihWE5HnS1kxLCReDmZJ 1qy7PWAGKke5KGOWqQOP6vBEfmEEliGhpCS7OcpSdd5XkyFm6gqbCeyqRKVXUum14xsT ryhLLqU/+Tr6sUyvQ8WCkspQ+/2WsFhkWqtCFq/O6F90AeXf02uZCaqI00JFVPqSlE43 zN++TvZ7Omjpn4//NVMr1i1EcauTO6y+TyK/OJz6JvAMBggp0zHp8+z4VdNR9RbebqOc /QfeFPRRAuRwPL93lq5eIDRxY7YQAMaS3UClSv3SuvQ+4hzeIqRU4Z9VdzcJJQtEV0Lr vDyw== 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:dkim-signature; bh=rhYnBQKzzjpsWttGzlyRthUCGzSdV8WWDcXlaXIYhD4=; b=SFKbs7aN/Rf32kQJpUBko5pL8XU+aoZrO8WEF4nUc0zYVe5hN9MUEvwICvS7nJBU6/ ErkDdZjNG9U9AbqIiU7Zg3KMA/fmyKVI3ZxvK/QLb8eJk204ewZmzE/bfA3ngzci6p7a u6nNSF7ZFr7PYFjW4HNvNqeZRPCGUWk3wR//jLUkd+1DBOIVqvEZwkfaVYGMf4icKtbo f1FkRTao1dDf7OD7/BnGs62dnDwfbFv8l+v9oUeiZWiXe/ut6nDr6VfnTn+NwnDUDLqT MCj52A7QOcZJQuu3ZcP00B1G0XagVwCekm8enpFBHWo+pM7+/u3skI4KZtjuB/PZCxZa iVtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YOs1cwei; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si26117182pgv.338.2019.06.05.01.27.02; Wed, 05 Jun 2019 01:27:19 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YOs1cwei; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726648AbfFEIZw (ORCPT + 99 others); Wed, 5 Jun 2019 04:25:52 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37477 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbfFEIZw (ORCPT ); Wed, 5 Jun 2019 04:25:52 -0400 Received: by mail-pg1-f196.google.com with SMTP id 20so11996479pgr.4; Wed, 05 Jun 2019 01:25:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rhYnBQKzzjpsWttGzlyRthUCGzSdV8WWDcXlaXIYhD4=; b=YOs1cweicWv8OrM2y6u2h2AujaDW8F5RqoCD8CKvAsXfodopZLHrv4Y4CGe2PrPQxI fX0Q+tLN0SHAhZd8FGpep73n8znvJbqq9sVzrSNTkw/tqAzE9vovyUv/BQEo4YnjACqG Jjo626rBQs5P5TaeY1b9mJXLiFhue4Wv0Icy1/qG31TQkxIqXW4gOeHnLePcYgGEJFY5 PfcldvgBrBeKUSD+/EJaEN5XqcEbxIDdDnHVNJmccANRIDcs9lxNrIQC2uwFPO9Ne5Ge UaqMiPg5GyR8q59yFu7qr9mTR+AaivJpl1ezgLE2FDoi0k14VundKfd1yy47h0KH5PFp ynPw== 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=rhYnBQKzzjpsWttGzlyRthUCGzSdV8WWDcXlaXIYhD4=; b=Su8WWGx6GixfNizLuZgO8IEtAk7uXd0UEiLNJz79M2jY66Sm5VWUkBRNDab6wMOnen k+q2rJEVoEzmoZCVX59tjPpYZ+bPNsB3drW/wDrF24kGQv4UEAjRkziusR2h2sn7GzPG ADL1ohZbRG8yBD9hV209aYcFBNWQcznB57lXnB+sV0MrXGSESLTTL0QL2peL0bJRLk1y AGG7+DeuXaRUGTl5zkBjxI7C2WF8ck4xFkeTjGKWk+SrBEUIZEzmK654BRkYc24NHGf7 bdZ/9So6VeG6ZHCG4XdROBsvn21KfeSm640ehHi4MCP0kwQAPIeHI9mVw9rIDUreJTFd zBDw== X-Gm-Message-State: APjAAAUE5Seu3JdfOtWsq9e3GrhZuApbXLEQ7aUOvBDJT391nH6zPaar wNtwSYrx4n9vblAhMI9VKdKcm8vQaaPpiiGNKTaodsjoOJQ= X-Received: by 2002:a63:fb05:: with SMTP id o5mr2858955pgh.203.1559723151256; Wed, 05 Jun 2019 01:25:51 -0700 (PDT) MIME-Version: 1.0 References: <20190531043347.4196-1-eduval@amazon.com> <20190531043347.4196-3-eduval@amazon.com> <20190604171611.GS9224@smile.fi.intel.com> <20190605032709.GA1534@u40b0340c692b58f6553c.ant.amazon.com> In-Reply-To: <20190605032709.GA1534@u40b0340c692b58f6553c.ant.amazon.com> From: Andy Shevchenko Date: Wed, 5 Jun 2019 11:25:39 +0300 Message-ID: Subject: Re: [PATCH 2/3] i2c: slave-mqueue: add a slave backend to receive and queue messages To: Eduardo Valentin Cc: Andy Shevchenko , Wolfram Sang , Haiyue Wang , Jarkko Nikula , Brendan Higgins , Rob Herring , Mark Rutland , linux-i2c , devicetree , Linux Kernel Mailing List 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 Wed, Jun 5, 2019 at 6:30 AM Eduardo Valentin wrote: > > Hey Andry, > > Long time no seeing :-) True! > > > +#define MQ_MSGBUF_SIZE CONFIG_I2C_SLAVE_MQUEUE_MESSAGE_SIZE > > > +#define MQ_QUEUE_SIZE CONFIG_I2C_SLAVE_MQUEUE_QUEUE_SIZE > > > > > +#define MQ_QUEUE_NEXT(x) (((x) + 1) & (MQ_QUEUE_SIZE - 1)) > > > > Also possible ((x + 1) % ..._SIZE) > > Right.. but I suppose the original idea is to avoid divisions on the hotpath. > > So, I am actually fine with the limitation of only using power of 2. The original code implies that anyway, so, my proposal doesn't restrict it any farther. > > > + { > > > + .compatible = "i2c-slave-mqueue", > > > + }, > > > > > + { }, > > > > No need for comma here. > > It does not hurt to have it either :-) It's just a protection against some weird cases of adding entries behind the terminator. > > > + .of_match_table = of_match_ptr(i2c_slave_mqueue_of_match), > > > > Wouldn't compiler warn you due to unused data? > > Perhaps drop of_match_ptr() for good... > > > Not sure what you meant here. I dont see any compiler warning. > Also, of_match_ptr seams to be well spread in the kernel. If this will be compiled with CONFIG_OF=n... Though I didn't check all dependencies to see if it even possible. In any case of_match_ptr() is redundant in both cases here. Either you need to protect i2c_slave_mqueue_of_match with #ifdef CONFIG_OF, or drop the macro use. P.S. Taking into account the last part, I would wait for v7 with that fixed followed by fixing other nits. -- With Best Regards, Andy Shevchenko