From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbbCIHN2 (ORCPT ); Mon, 9 Mar 2015 03:13:28 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:33229 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752057AbbCIHN0 (ORCPT ); Mon, 9 Mar 2015 03:13:26 -0400 Message-ID: <54FD480D.40604@linaro.org> Date: Mon, 09 Mar 2015 07:13:17 +0000 From: Srinivas Kandagatla User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Mark Brown CC: linux-arm-kernel@lists.infradead.org, Maxime Ripard , Rob Herring , Pawel Moll , Kumar Gala , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stephen Boyd , andrew@lunn.ch, Arnd Bergmann , Greg Kroah-Hartman Subject: Re: [PATCH v1 1/6] eeprom: Add a simple EEPROM framework for eeprom providers References: <1425548685-12887-1-git-send-email-srinivas.kandagatla@linaro.org> <1425548741-12930-1-git-send-email-srinivas.kandagatla@linaro.org> <20150307150035.GN28806@sirena.org.uk> In-Reply-To: <20150307150035.GN28806@sirena.org.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/03/15 15:00, Mark Brown wrote: > On Thu, Mar 05, 2015 at 09:45:41AM +0000, Srinivas Kandagatla wrote: > >> + >> + return eeprom; >> +} >> +EXPORT_SYMBOL(eeprom_register); > > This framework uses regmap but regmap is EXPORT_SYMBOL_GPL() and this is > using EXPORT_SYMBOL(). > Thanks for spotting this, I will fix this in next version. >> +int eeprom_unregister(struct eeprom_device *eeprom) >> +{ >> + mutex_lock(&eeprom_mutex); >> + if (atomic_read(&eeprom->users)) { >> + mutex_unlock(&eeprom_mutex); > > Atomic reads and a mutex - isn't the mutex enough? Atomics are > generally a recipie for bugs due to the complexity in using them. Yes, you are right as long as we protect users variable with mutex, using atomic is really redundant, will fix it in next version. >