Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp454064imm; Fri, 31 Aug 2018 05:04:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbWg0WsiDH/4RzdkIGS+qWWow7P52ms1YS+lDnfw1jMV2ow1mDCrXbUis02+Snnj2aNDyv0 X-Received: by 2002:a63:e318:: with SMTP id f24-v6mr12457161pgh.175.1535717071212; Fri, 31 Aug 2018 05:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535717071; cv=none; d=google.com; s=arc-20160816; b=dRhHN36QLIWaDhRiJoSh39FEOD6eXPWUrE1MdlyjOkIUkW1LxUaP9FPmTY5bnpZk4N 46gBhbUS7eLJxE5UiDkGzeIn+xJhx+bYab1tnT+ZlctzKHs+Fneug1Ef8gOKRtBWxkSR k3gN32as+3Fkl1tasVeKFzpGmFMFHZFfO5a+7jnp0FKPNXd+Zq47ycH9QiZeSaENJQjQ MWmoubGVC3QLoCG2PLKPT9voKrUAliJMbtsT2iKHYUoVmmEkuq12YCWluZsdmD2+ephC y7BFD5HLcdX2ZBOOqJ40czontMnmnNIZRrL/43uEPJB6kx0x7TmcFmdF4WoRB/k4NGvK MApw== 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:arc-authentication-results; bh=g23Jav/GE8wTV/mUKWa7PBe1jf+BXZ4swiVc/i04iMM=; b=vdtaTTHMDHGr0GeBuKwaquRdB2uWpZfWvgx1pqQusooLIssOithBQpNZ/PzrLXPLMb 4x0nddCOA2NrjoVYqVQitFXl4NoefzMLuH3HfbnBYD4bWF+mfTliUJi02KGHBubUCi9y oiKh0TeLRvp2hcE2snuA9/Sh14IsfirsrfeLm06CL6mLZxqLTqVRm2+G4yS8trUXfhyD bbW7p2PzFrD+jC0v4yNNVTmtsbvD6Bb7leELvW3NG+r1muBdsEvXg65nSpTFjC/mDqff 3ORkxvyUUGv8Nv00R6WBcveTZokpdvGs705ZwR0VbOz5ghTdzF0Ja+lzfYKOOCVDEqqd j8Ng== 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 l5-v6si9509187pgb.686.2018.08.31.05.04.16; Fri, 31 Aug 2018 05:04:31 -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 S1727998AbeHaQFW convert rfc822-to-8bit (ORCPT + 99 others); Fri, 31 Aug 2018 12:05:22 -0400 Received: from smtprelay01.ispgateway.de ([80.67.31.39]:37766 "EHLO smtprelay01.ispgateway.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727207AbeHaQFW (ORCPT ); Fri, 31 Aug 2018 12:05:22 -0400 Received: from [89.1.81.74] (helo=karo-electronics.de) by smtprelay01.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fvi40-0002oC-VK; Fri, 31 Aug 2018 13:58:09 +0200 Date: Fri, 31 Aug 2018 13:58:07 +0200 From: Lothar =?UTF-8?B?V2HDn21hbm4=?= To: Yogesh Gaur Cc: linux-mtd@lists.infradead.org, boris.brezillon@bootlin.com, marek.vasut@gmail.com, linux-spi@vger.kernel.org, devicetree@vger.kernel.org, mark.rutland@arm.com, robh@kernel.org, linux-kernel@vger.kernel.org, frieder.schrempf@exceet.de, computersforpeace@gmail.com, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/7] spi: add slave device size in spi_device struct Message-ID: <20180831135807.22255bce@karo-electronics.de> In-Reply-To: <1535711404-29528-2-git-send-email-yogeshnarayan.gaur@nxp.com> References: <1535711404-29528-1-git-send-email-yogeshnarayan.gaur@nxp.com> <1535711404-29528-2-git-send-email-yogeshnarayan.gaur@nxp.com> Organization: Ka-Ro electronics GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Df-Sender: bHdAa2Fyby1lbGVjdHJvbmljcy5kZQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, 31 Aug 2018 15:59:58 +0530 Yogesh Gaur wrote: > Add 'size' data variable in spi_device struct. > This is to save the size of the connected slave device. > > After slave device scan, spi_nor_scan, size being assigned to this > from MTD layer. > > SFDP read is being requested before completion of spi_nor_scan() > routine, thus populate device size before making read request > to the SPI controller. > > Signed-off-by: Yogesh Gaur > --- > drivers/mtd/devices/m25p80.c | 6 ++++++ > drivers/mtd/spi-nor/spi-nor.c | 2 ++ > include/linux/spi/spi.h | 2 ++ > 3 files changed, 10 insertions(+) > > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c > index fe260cc..6c7ad86 100644 > --- a/drivers/mtd/devices/m25p80.c > +++ b/drivers/mtd/devices/m25p80.c > @@ -124,6 +124,10 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len, > /* convert the dummy cycles to the number of bytes */ > op.dummy.nbytes = (nor->read_dummy * op.dummy.buswidth) / 8; > > + /* for case of SFDP header read commands, populate spi device size */ > + if (flash->spimem->spi->size == 0) > + flash->spimem->spi->size = nor->mtd.size; > + If the 'size' is an spimem specific variable it should be added to the spi_mem struct rather than the spi_device struct. Lothar Waßmann