From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt0-f193.google.com ([209.85.216.193]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cVoFm-00072Z-2s for linux-mtd@lists.infradead.org; Mon, 23 Jan 2017 23:42:27 +0000 Received: by mail-qt0-f193.google.com with SMTP id n13so20984505qtc.0 for ; Mon, 23 Jan 2017 15:42:05 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <06d8264e-5ddb-aa76-a83e-4c2c3af42f08@denx.de> References: <1484949023-2085-1-git-send-email-kdasu.kdev@gmail.com> <3e1f1c8e-4a87-e186-20cb-2ba784bd58d5@denx.de> <06d8264e-5ddb-aa76-a83e-4c2c3af42f08@denx.de> From: Kamal Dasu Date: Mon, 23 Jan 2017 18:41:03 -0500 Message-ID: Subject: Re: [PATCH, 1/2] mtd: m25p80: Let m25p80_read() fallback to spi transfer To: Marek Vasut Cc: Michal Suchanek , Cyrille Pitchen , Mark Brown , bcm-kernel-feedback-list , Florian Fainelli , MTD Maling List Content-Type: text/plain; charset=UTF-8 List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , "ret can never be > 0 , it is only 0 or negative " I can fix this. >>> This looks really fragile and special-casing EINVAL here doesn't scale. >>> But still, if your controller driver is buggy, fix the driver, do not >>> pollute core code with workarounds. If you do support this sort of >>> accelerated read and it fails, it means something is seriously wrong. >>> If you need to invoke regular SPI reads to complete under some obscure >>> circumstances, do it from the driver, not here. >> >> I guess the other half of m25p80_read can be factored out and used as >> fallback from either m25p80_read or the controller driver. > > I think I see what you mean, but care to show an RFC patch ? > > -- Its not the controller driver, but he hardware limitation with older controller version. I have tried to see how I can do this better, however when spi_flash_read() is called cannot handle it within my driver without returning from the function. I went over this with Mark previously and this current solution seemed reasonable. Any other solution outside of the generic driver would replicate a lot of code unnecessarily. > Best regards, > Marek Vasut Thanks Kamal