Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp967870imm; Wed, 8 Aug 2018 08:36:02 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz8uBx4Fm8DxJD150v9jGd2zOOZvgUZvLhsGk+3vtzupZnxzqfpEgHfXOACz0f6DtKCnua2 X-Received: by 2002:a62:4704:: with SMTP id u4-v6mr3476964pfa.76.1533742561957; Wed, 08 Aug 2018 08:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533742561; cv=none; d=google.com; s=arc-20160816; b=EQkIARcdqiBLZAswthKHrm2b9m0VeeSHXyONamSWYDAGdBUA1JOtJ4iBVW0zhYrBeP PAg1LhmYeKA+CWA0eQ5NDRabRQnYoipufj/c8FDeXCsffI2Ql+gcoAIOfcJ0mWP9BBLp 77JUfzww7Lk+GEoBUoVFzyDhmJF7y36q7zgIonA3KWmRBzdMP2Cspy85O8/JykVLWLN1 bc2PrZjPDD4zWhS7/N/QDOdhPNQEA/elR5vANnXYKFREIsfsoVT/kevh0HaKPsAqpv8J CaRJ1hjNmYRgt7WAfA8G+Xp3v7a2SPnzyDO1N8yyc6xgPp3IYscUtv8tSp+IA4YfMxcD rNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=FSHdY6zctlDkYyxEvPBDzCoV80UVARiCoyzJIuK3YLA=; b=oqX8cG2inYsfDA4BRgsvJChxOf2janQlN9Dexw/+aaiTIrEEd6eqroPeTqw4rnmNix UAYB08SUyn2gav/rLBtHUxm0idvEdrt7PadU25i9JlDa+i/APZJOLiTt4Xy1OzDN6wJh oekGuS6T6ohIwDZYJHjoq1RU/PBTDKqxBcvC1gQ9kgjViGdwTsw+PAglu/gfvT33y2KT brSWhOhJ1q9rzlv+YBeGyldFO/VLne4BJACHuVUZ2ViumlLhNICkrOhCgqjIYI6CshMm u515EtFxWz+cEFZuchjLd4l87rDgltHj3ayKV/6sJTGfsU5aLJMU8sBYAP2O1DRNW46U aTJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=gAHlXd96; 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 q3-v6si3591617pgv.652.2018.08.08.08.35.47; Wed, 08 Aug 2018 08:36:01 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=gAHlXd96; 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 S1730480AbeHHRyd (ORCPT + 99 others); Wed, 8 Aug 2018 13:54:33 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46561 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730281AbeHHRyc (ORCPT ); Wed, 8 Aug 2018 13:54:32 -0400 Received: by mail-wr1-f67.google.com with SMTP id h14-v6so2378926wrw.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=AOdVDj6bU93KmVyxcSJwqNmcPKsKWUI6Cu3Gjsl8W5vaVzEm+tXzDCtO7LgTu+LrxU SGxefpe5dh5bhRA9dgfIdhgOpyPT01iUeJS4ud63aEHMcLHLDEsW0tmCvz2dYM1PEL3c BhDi3tXQMqWAxTMbE9oK/CdaNffVhdGQAW55Zbk89Zd3RGiLPRKLZ9q0QY2xeeXJ3vJe 4BSaE0fE2WPQVmoA7afgIdq3KdP90mmsRuCKr90O38v+yWca0SnvA6oTY4eFS381UBs4 4qric3C9J4LvlU4mIQhWs4sg/dma03EJEE9y7Uiyw+tQusWnfAPeFq0K5ZYB8G9ndV+y MgCw== X-Gm-Message-State: AOUpUlGL8xVHM7U4K748sCV0CGKl/DoHzSsckXAm0pj9bLLvEA6cTNhS VvaoERi0dBUR2TX1Dwa4HzKscA== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(); -- 2.18.0