Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2963842imm; Fri, 10 Aug 2018 01:08:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyBqq7zXgMpR9nE+U2gUYRMxHx8IXECqO5JJ9QMUg3dFAFx3eFWJVbX2V35eXzEIJTj6FG4 X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr5220731pli.309.1533888486284; Fri, 10 Aug 2018 01:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533888486; cv=none; d=google.com; s=arc-20160816; b=DkaBLtsbaRj/hxE87SN1DoKwVjkGppvLafqDurWxguwGWaeFemJJT/oCLZF2Oda8Ge N9nVZE19tInbGjCTSTZH0SwjgAhB11bM5p0gyb40OKUqxtrLK2vHLyjvoKndIYwCVR9g m4s8m3/jXe5mdzLHgz7CE9PIZqXEmeDFkNzi3jprD5SPFAUSPICYL+Yyd2cK7aqu6EQF O87SSZ+NkYd+1UBE+TP8kzk9QK4vzZsB+wpCOlt186pD5uDwQOZ+hDCN/76v2gAZK7xE 25mxc3QTngpd70S09jOHfZJZqKYjdiJ0jLpOENPjiEOa2/OhE5vWKCchXxlle1QZUJTB RRGA== 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=jh45iyxzAhZV5lh7mev1xkgD1t3NViMmTz6DgxZZu/M=; b=w/kn4EGEKFs57u35v9AX0rjBlmbDK2dpXXV30oj0q9GAFGny0OnrZmfPyhwSP76XrK XCzrGH24oaboWMRSGfLaoKG37KcwEs89LyF8A7VHA5CyIYkPoaFgC1QNko0aYnSB8LFB vPj+ndge4d4tLelA5zIoM4N9BzYrz+yEe/Ukog2FTkT13PUS6MhPQrEEuFcisWfhkI4U LDfDbIjNm9rLnTifmOj80JGLu5v77hbY4CSQ8A/5NwX380hC3UP16h/2CF7ZS9Ugn8Xy nc6ralGofZyE1iyVSRsQGrS1MfdPyGbHSKwGtTdtibF/dTlE+jrWNBl+YSaotDHittqm lzrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=bNyrEded; 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 94-v6si7976062plb.59.2018.08.10.01.07.51; Fri, 10 Aug 2018 01:08:06 -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=bNyrEded; 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 S1729300AbeHJKfM (ORCPT + 99 others); Fri, 10 Aug 2018 06:35:12 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35142 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729208AbeHJKfK (ORCPT ); Fri, 10 Aug 2018 06:35:10 -0400 Received: by mail-wr1-f68.google.com with SMTP id g1-v6so7487420wru.2 for ; Fri, 10 Aug 2018 01:06:25 -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=jh45iyxzAhZV5lh7mev1xkgD1t3NViMmTz6DgxZZu/M=; b=bNyrEdedPXI5zGAmm/tROj6OOi3+u09cTRTqviKGU5O3cKOoc+EdIWMSArqZ/R2BD2 jqWPbkJem4BecHC9z6vwqj7wqV1arfFk60D25XPh+NqSnQlyaxVKYn3R3a8KduDXYTMv SdPzch1LepaSQLGiQCg3HWwnhPFxsKOSHN5Y+Rg1P37Ew2L/uZiw9FBI8Cq0AkRLHwzr csG9U5aJINf3VitBZNpKUL6tQTRKSkBjKsoOn4EHIGuVOfx6M8hBhLr86sC9Oj+hpJs+ +PtyWT8uo79iN1UTp64Fag+lXGeqopDTzNMPUn3P/R8/9gNPYB9X+dlCWCsbv71Xwags sdQw== 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=jh45iyxzAhZV5lh7mev1xkgD1t3NViMmTz6DgxZZu/M=; b=mz4oNI7zts3z8+srV4iwvqwwHr8I5JuSgF01VcFiL5ZXFUIgNhlcI7RDpLbOPGcwVK RXfcbswos7gkDXWJdAYf5Cn66XiH19K2kuFPO3eI9x6zAh6igkF/YErZymOIETDm0cuu GTTk8k9uzkaRGzWy0h7q/MaD3Tv9nG6jxSS92iEPEPPRd4kClc6kapBNukj1X7i6hcZF 7TUUQtVHFxlopzyycBfUG40hsxRvn9DFTCBMXie0JctbtN2gCIYQ8ikas4jg19YkjHXD FBtofQl7pAnc4/NYThxu6N9GA2UViuCf7wLMlBQIPC53ByySbsZndxr5k8fC2iSv6SIn VUAQ== X-Gm-Message-State: AOUpUlHAS8Gb0DrJo+pPJFo9TCn3aGDOGcWk7z/4bBBWcTBb5MyPF6jR phRmJ+wQimpzE/DK+DVCpIgLvQ== X-Received: by 2002:a5d:4a07:: with SMTP id m7-v6mr3756039wrq.8.1533888384610; Fri, 10 Aug 2018 01:06:24 -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 h7-v6sm9546405wrs.8.2018.08.10.01.06.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 01:06:24 -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 v2 27/29] ARM: davinci: mityomapl138: use nvmem notifiers Date: Fri, 10 Aug 2018 10:05:24 +0200 Message-Id: <20180810080526.27207-28-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180810080526.27207-1-brgl@bgdev.pl> References: <20180810080526.27207-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 35b2b6068a7a..dacc5292f9bd 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c @@ -15,6 +15,8 @@ #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_dev_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