From patchwork Wed Aug 8 15:31:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61A4615A6 for ; Wed, 8 Aug 2018 15:34:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E9D029E6D for ; Wed, 8 Aug 2018 15:34:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4147A29EF1; Wed, 8 Aug 2018 15:34:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C54CF29E6D for ; Wed, 8 Aug 2018 15:34:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730267AbeHHRyc (ORCPT ); Wed, 8 Aug 2018 13:54:32 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46562 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730288AbeHHRyc (ORCPT ); Wed, 8 Aug 2018 13:54:32 -0400 Received: by mail-wr1-f68.google.com with SMTP id h14-v6so2378928wrw.13 for ; Wed, 08 Aug 2018 08:34:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FSHdY6zctlDkYyxEvPBDzCoV80UVARiCoyzJIuK3YLA=; b=gAHlXd963WQRDMseqLKzq+CSBwUuAdYlGVYWDDqcgkLvPzZ3mjKXTxscWrDgMJAmWw Wvp1LRY0O3YiSP1OyZO+QaPTdvyFcvOc/RAynOtGMzMW0PpIhZEF6KgK4CL5zWWqPY5P PmmEVNzDs+WmoI+9X3zxmXtjAvTiCKI5N2bl5i93TNntKd7yoGuae56rPGG7Pgb9d1Wt t1x+UghQ8ebVKYvLrTEojYZ+A0cJhPxLTvdM5HJ7W3RDN/r0uJk2STc7Qu6MPyapwKRO TJOsU8Z+71nAQZlomaSN0ogD+f+2mDU43YpW/2H0fMM68C6TUVd6OZpHtWGpeY00WUB2 tomQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FSHdY6zctlDkYyxEvPBDzCoV80UVARiCoyzJIuK3YLA=; b=h6i/Uw7kIkd/72RfAfWXoAb4I6PEB0W/OJF8+ESRQkt9/9Psu15Ql1ZIo1u+QZsc6x iVTvlXYipafDWIgdpeUhp25r6JBw8+tmICat4fHutuxiy9vxpgXy+qyI5cxBD9vzb0o5 8PrDqfYPtDesC2hNgxGUkOYE9ypAOS3uDq+rUsTe80bMtjX8XFFse9NaNAACR+lt6khm MI8Dso5HMcVvag0y7C6/aYgIRl22MTzPkz0c0kIe/vbcavpdvPtn3K3SSAPeGPBfWMOq noejaDgyC5PCitDZhz6aWfdZ/PquEIJMPomp7p2A2s5tId7RAivAeksC/n+qHHsmaLJN mpTA== X-Gm-Message-State: AOUpUlEZJZInfvfLmoJrsuC+nT6Amn6vyTviW54DVfq0PgQW7h+mVVn4 OwGxAt4eEMugu9AZFSfMfBdXEg== X-Google-Smtp-Source: AA+uWPyUK+ZAquD4IIWwhTosIbWrpsz89OnHAL4DrHBb/QfLzilJnt0DZ6qPws2spLmz0eVqRpf0JA== X-Received: by 2002:adf:f790:: with SMTP id q16-v6mr2236663wrp.86.1533742460112; Wed, 08 Aug 2018 08:34:20 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.34.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:34:19 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 26/28] ARM: davinci: mityomapl138: use nvmem notifiers Date: Wed, 8 Aug 2018 17:31:48 +0200 Message-Id: <20180808153150.23444-27-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Stop using the at24_platform_data setup callback in favor of nvmem notifiers. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-mityomapl138.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index 5c0a0557a361..17b67e26bc0e 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -15,12 +15,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -116,10 +118,15 @@ static void mityomapl138_cpufreq_init(const char *partnum) static void mityomapl138_cpufreq_init(const char *partnum) { } #endif -static void read_factory_config(struct nvmem_device *nvmem, void *context) +static int read_factory_config(struct notifier_block *nb, + unsigned long event, void *data) { int ret; const char *partnum = NULL; + struct nvmem_device *nvmem = data; + + if (strcmp(nvmem_device_name(nvmem), "1-00500") != 0) + return NOTIFY_DONE; if (!IS_BUILTIN(CONFIG_NVMEM)) { pr_warn("Factory Config not available without CONFIG_NVMEM\n"); @@ -151,8 +158,14 @@ static void read_factory_config(struct nvmem_device *nvmem, void *context) bad_config: /* default maximum speed is valid for all platforms */ mityomapl138_cpufreq_init(partnum); + + return NOTIFY_STOP; } +static struct notifier_block mityomapl138_nvmem_notifier = { + .notifier_call = read_factory_config, +}; + static struct nvmem_cell_lookup mityomapl138_nvmem_cells[] = { { .info = { @@ -176,8 +189,6 @@ static struct at24_platform_data mityomapl138_fd_chip = { .byte_len = 256, .page_size = 8, .flags = AT24_FLAG_READONLY | AT24_FLAG_IRUGO, - .setup = read_factory_config, - .context = NULL, }; static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { @@ -546,6 +557,7 @@ static void __init mityomapl138_init(void) if (ret) pr_warn("spi 1 registration failed: %d\n", ret); + nvmem_register_notifier(&mityomapl138_nvmem_notifier); nvmem_add_lookup_table(mityomapl138_nvmem_cells, ARRAY_SIZE(mityomapl138_nvmem_cells)); mityomapl138_config_emac();