Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp823803ybb; Thu, 28 Mar 2019 12:56:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7wOYQfJEFq6d1P6lJ9+QP9SnP5d8lUo4cCXFwnkY2qWgCoQnO6p23f9UWWsBBDHYf9k+Q X-Received: by 2002:a17:902:e90b:: with SMTP id cs11mr43871498plb.197.1553802980566; Thu, 28 Mar 2019 12:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553802980; cv=none; d=google.com; s=arc-20160816; b=byrmjbty9cBDThgnkGvXxrvX6ZiD18BZCX6fDS1JsKyJTzUuBvG8+0KbAp61BVLU+z a0hArxb7+RTSH6dVcKSb8BT6kz8aRyD3DWSbZ2qDmByLH/feQAqvX0ZLycVAe7i0l6pY W1vhMUvDAqy4akqhkW+hEkMfmEtqNQoLGbVgVWXSGFoT5tlhJYGPgTgquRCaNXD2R07a anFYRH6q7GndapQK39vfxhLyDYD5aDgBhIBkrr0csUMgqmcCh4Ew40NUqmu6dPVOAfGL MdI/cgNk9qqpyhielgY5kD7GznfmLnHml2SlUrbBKGXmZX8QwxkDBM5ig8nXSh1m2K8M 7BPA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=LBovw9TZCXMmEYy3TquZhN3T+kjXj2e+wU0J08KEqCc=; b=XdnfbI1YaciPKOWvYlnDbUdY7OMdDkIxAYer3IsifbuA0TVP+cVCuVnjDcuFeVhOy9 zZBwonQbYAImsbMp/pBvhMbz10fSsol3OsTHX/54M2eSgf2HGR1viVebcb2DOGFWWLrO hZFpjXz4G0XdG1IEfAChmCkCdDn4C7ddBBSXA8uEwohvJvWi3hX9iYaZNw+55ikEN8WV IBawK7aulIsUZ+YkiU1MZc1pN9bQl+GAF/RrHBGWZ8fBvbYeO5gLEZxz5K5yy+ojiBET IE71O216BWvnGySnKew3aBzNkCSR2fUYDZexC6qHcnIF5uu4MuUz941yn2W/peIbAvsR csxg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si28008plg.3.2019.03.28.12.56.03; Thu, 28 Mar 2019 12:56:20 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726171AbfC1Tz2 (ORCPT + 99 others); Thu, 28 Mar 2019 15:55:28 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54534 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725852AbfC1Tz2 (ORCPT ); Thu, 28 Mar 2019 15:55:28 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 2C86028227F; Thu, 28 Mar 2019 19:55:26 +0000 (GMT) Date: Thu, 28 Mar 2019 20:55:22 +0100 From: Boris Brezillon To: Naga Sureshkumar Relli Cc: , , , , , , , , , , Subject: Re: [LINUX PATCH 2/3] spi: spi-mem: call spi_mem_default_supports_op() first Message-ID: <20190328205522.272e1da6@collabora.com> In-Reply-To: <1553771784-3364-1-git-send-email-naga.sureshkumar.relli@xilinx.com> References: <1553771784-3364-1-git-send-email-naga.sureshkumar.relli@xilinx.com> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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, 28 Mar 2019 16:46:24 +0530 Naga Sureshkumar Relli wrote: > Call spi_mem_default_supports_op() first, before calling controller > specific ctlr->supports_op(). > With this, controller drivers can drop checking the buswidths again. No, this was done on purpose, in case the controller does not want the default check to be applied (say it does not need bus-width props to be defined and has another way to check if a device can be accessed in dual, quad or octal mode). Just call spi_mem_default_supports_op() from your driver ->supports_op() hook if needed. > > Suggested-by: Vignesh Raghavendra > Signed-off-by: Naga Sureshkumar Relli > --- > Details can be found at https://lkml.org/lkml/2019/3/1/183 > --- > drivers/spi/spi-mem.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c > index 5217a56..56aa158 100644 > --- a/drivers/spi/spi-mem.c > +++ b/drivers/spi/spi-mem.c > @@ -189,11 +189,14 @@ static bool spi_mem_internal_supports_op(struct spi_mem *mem, > const struct spi_mem_op *op) > { > struct spi_controller *ctlr = mem->spi->controller; > + bool ret; > + > + ret = spi_mem_default_supports_op(mem, op); > > if (ctlr->mem_ops && ctlr->mem_ops->supports_op) > - return ctlr->mem_ops->supports_op(mem, op); > + ret = ctlr->mem_ops->supports_op(mem, op); > > - return spi_mem_default_supports_op(mem, op); > + return ret; > } > > /**