From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423410AbcBQWLo (ORCPT ); Wed, 17 Feb 2016 17:11:44 -0500 Received: from vps0.lunn.ch ([178.209.37.122]:50705 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965653AbcBQWLn (ORCPT ); Wed, 17 Feb 2016 17:11:43 -0500 Date: Wed, 17 Feb 2016 23:11:32 +0100 From: Andrew Lunn To: Joachim Eastwood Cc: Srinivas Kandagatla , GregKH , Maxime Ripard , Wolfram Sang , Mark Brown , Vladimir Zapolskiy , "linux-kernel@vger.kernel.org" , Pantelis Antoniou , bgolaszewski@baylibre.com Subject: Re: [PATCHv5 6/7] eeprom: 93xx46: extend driver to plug into the NVMEM framework Message-ID: <20160217221132.GE25818@lunn.ch> References: <1455739675-24840-1-git-send-email-andrew@lunn.ch> <1455739675-24840-7-git-send-email-andrew@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2016 at 11:02:56PM +0100, Joachim Eastwood wrote: > Hi Andrew, > > On 17 February 2016 at 21:07, Andrew Lunn wrote: > > Add a regmap for accessing the EEPROM, and then use that with the > > NVMEM framework. Enable backward compatibility in the MVMEM config > > typo: MVMEM Thanks > > +/* > > + * Provide a regmap interface, which is registered with the NVMEM > > + * framework > > +*/ > > +static int eeprom_93xx46_regmap_read(void *context, const void *reg, > > + size_t reg_size, void *val, > > + size_t val_size) > > +{ > > + struct eeprom_93xx46_dev *eeprom_93xx46 = context; > > + off_t offset = *(u32 *)reg; > > + int err; > > + > > + err = eeprom_93xx46_read(eeprom_93xx46, val, offset, val_size); > > + if (err) > > + return err; > > + return 0; > > Can be: > return eeprom_93xx46_read(eeprom_93xx46, val, offset, val_size); > > Allows you to remove the 'err' variable also. Nope. regmap wants a return value of 0 or error. eeprom_93xx46_read() returns how many bytes where actually read. So we either need this code here, or we change the return from eeprom_93xx46_read(). Andrew