Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp315546ybl; Fri, 9 Aug 2019 06:29:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRVUc0oywPJJtoNKukqX5b95ETO4jJ6pfRO6S9nXVQb+NVMT/oEyBSPnirSKimUOzHdzTr X-Received: by 2002:a63:4846:: with SMTP id x6mr17769329pgk.332.1565357353753; Fri, 09 Aug 2019 06:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565357353; cv=none; d=google.com; s=arc-20160816; b=S1Qmh6pEHhdgAMoB9Jad9oJzvzRoyIDmMnXcETrghuEM6v/uA9i0piUZh/5qQpj638 0r+DOt1Uy5UQnR9VclLM/QREDTOucaNI7KuCbivWhU8UOqJVgA1W2oxGWVJtDLHvYviQ wCTgOtQtaOBTMFLdDU05fT5M2igIY2tGUFrWCWN8/4+DYg754XVMjM+kuy2LNDzzyO13 OCXpYSCJNXCzcHXo2IaVWf6SKrC5ye0bXkrnUZjbb03n5qAezJHtEtrjmPwt8zcI2GNk XO81aeO0PGu4McSG1Q4EabkpbAgMGi1MSmRhaZ5ez2twpuKbN1qWWQX8nqLIElN4Eutj ZGtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HMK6fJIVm0ZDSMyNUPcotB86CXI//wO5kVXZ85Ti/Ig=; b=RlcidMWXmnWfkVHXvmY90gGWtybrOT/8iYphPWt0YL9r01mhuE3aUBsM/BHaPC1oBD Hj/MC+KVoKUSvjAL5+1nfvMiVLYX4RTZkfky9OCL0peJMtwUy1/D2F9OadGK28evN0R5 0rdiUzSVbxuqI+m1BnbQWGelBoohLzEEU9Ghw0IdhqxlkUshrtq4dFwRXCV4zDRqgUti QWnIRL9NYKyMV15yYrfAa27rxTGqBUYNLn28zPD9AtXhEsVXqnJRXMMC+E17vLrwq9VL vgzEm0mu1Ot7i0t2SlP8e1IM+zr+u3L3Wg+0Zwvd5E1OUNI2K+bq8/wZkse0q24h3j1H HJ9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oxB3Emcy; 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 h17si1649682pjq.16.2019.08.09.06.28.57; Fri, 09 Aug 2019 06:29:13 -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=@kernel.org header.s=default header.b=oxB3Emcy; 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 S2407076AbfHIN2N (ORCPT + 99 others); Fri, 9 Aug 2019 09:28:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:55152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbfHIN2N (ORCPT ); Fri, 9 Aug 2019 09:28:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8DDE1214C6; Fri, 9 Aug 2019 13:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565357292; bh=5H5b7y+4EokoM0HkClMwlRbqVVUaENMdf+M7pdtzgA0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oxB3Emcyz8XTPMJKE3Y0ERvCS3wx3MpN4HaZYeFBjqS8FG4CZT8m8P1NeKaiqiw2g a9zHd52yoo+fRNoy4aQfLm9DfU2BVXZj8f81DtNHf+dtP4quAWeOFSci/xnCEVebMm NME5uEl0BR2gU5/vRVgQhTn4PmcIyOQZq4sUTsYg= Date: Fri, 9 Aug 2019 15:28:09 +0200 From: Greg Kroah-Hartman To: Joe Burmeister Cc: Rob Herring , Mark Rutland , Arnd Bergmann , Srinivas Kandagatla , YueHaibing , Bartosz Golaszewski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Add optional chip erase functionality to AT25 EEPROM driver. Message-ID: <20190809132809.GA30876@kroah.com> References: <20190809125358.24440-1-joe.burmeister@devtank.co.uk> <20190809130005.GA13962@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 09, 2019 at 02:18:24PM +0100, Joe Burmeister wrote: > Hi Greg, > > On 09/08/2019 14:00, Greg Kroah-Hartman wrote: > > On Fri, Aug 09, 2019 at 01:53:55PM +0100, Joe Burmeister wrote: > > > +static void _eeprom_at25_store_erase_locked(struct at25_data *at25) > > > +{ > > > + unsigned long timeout, retries; > > > + int sr, status; > > > + u8 cp; > > > + > > > + cp = AT25_WREN; > > > + status = spi_write(at25->spi, &cp, 1); > > > + if (status < 0) { > > > + dev_dbg(&at25->spi->dev, "ERASE WREN --> %d\n", status); > > > + return; > > > + } > > > + cp = at25->erase_instr; > > > + status = spi_write(at25->spi, &cp, 1); > > > + if (status < 0) { > > > + dev_dbg(&at25->spi->dev, "CHIP_ERASE --> %d\n", status); > > > + return; > > > + } > > > + /* Wait for non-busy status */ > > > + timeout = jiffies + msecs_to_jiffies(ERASE_TIMEOUT); > > > + retries = 0; > > > + do { > > > + sr = spi_w8r8(at25->spi, AT25_RDSR); > > > + if (sr < 0 || (sr & AT25_SR_nRDY)) { > > > + dev_dbg(&at25->spi->dev, > > > + "rdsr --> %d (%02x)\n", sr, sr); > > > + /* at HZ=100, this is sloooow */ > > > + msleep(1); > > > + continue; > > > + } > > > + if (!(sr & AT25_SR_nRDY)) > > > + return; > > > + } while (retries++ < 200 || time_before_eq(jiffies, timeout)); > > > + > > > + if ((sr < 0) || (sr & AT25_SR_nRDY)) { > > > + dev_err(&at25->spi->dev, > > > + "chip erase, timeout after %u msecs\n", > > > + jiffies_to_msecs(jiffies - > > > + (timeout - ERASE_TIMEOUT))); > > > + status = -ETIMEDOUT; > > > + return; > > > + } > > > +} > > > + > > > + > > No need for 2 lines :( > > Sorry, other coding conventions I'm used to. checkpatch.pl should have warned you about this, you did run that before sending your patch out, right? > > > +static ssize_t eeprom_at25_store_erase(struct device *dev, > > > + struct device_attribute *attr, > > > + const char *buf, size_t count) > > > +{ > > > + struct at25_data *at25 = dev_get_drvdata(dev); > > > + int erase = 0; > > > + > > > + sscanf(buf, "%d", &erase); > > > + if (erase) { > > > + mutex_lock(&at25->lock); > > > + _eeprom_at25_store_erase_locked(at25); > > > + mutex_unlock(&at25->lock); > > > + } > > > + > > > + return count; > > > +} > > > + > > > +static DEVICE_ATTR(erase, S_IWUSR, NULL, eeprom_at25_store_erase); > > > + > > > + > > Same here. > > > > Also, where is the Documentation/ABI/ update for the new sysfs file? > > There isn't anything for the existing SPI EEPROM stuff I can see. > > Would I have to document what was already there to add my bit? Yes, someone has to, sorry :) thanks, greg k-h