From patchwork Fri Aug 10 08:05:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10562437 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 82CF41390 for ; Fri, 10 Aug 2018 08:22:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 704EE2B795 for ; Fri, 10 Aug 2018 08:22:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63DEF2B7A2; Fri, 10 Aug 2018 08:22:35 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0A5EC2B795 for ; Fri, 10 Aug 2018 08:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=iYvpRhU/KjhVd82pdcq31yODy/DhfZqY1OrJ87R6J8g=; b=eLeRYM8gZ3YqdDFS1cufv9/Cn+ eOeq7BiqrOaFalVVj3wQFO+TCdktx8t5dfavnMPZSFGnO5VBx/BkhxTH1FjNK7JPY2V/UoZbIYAeL EjYJ3Wu33Jq4B8Yz7cCl9EnTYJTjNf8mMB1vd7ntlfLuzsmvjKjBwNt05RBSqlbX4Doq1/km1KznA g6vKaQbxKe75UXv6guSia7Xf3K5G302+Gj2wZtOkdoENJPwxLNshnhv+bNpFNkn/EsnIru6XaOF6g IIWbcC8+Czpn+aI2toI3nHfyZKX89XFQkvbKbaaAlNIRQh4B1ISSM4YR+Pd/1xhTw5zul6joh3GU7 8LSc/XVg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fo2gm-0007uA-Sx; Fri, 10 Aug 2018 08:22:28 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fo2gb-0007aF-9f for linux-arm-kernel@bombadil.infradead.org; Fri, 10 Aug 2018 08:22:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jh45iyxzAhZV5lh7mev1xkgD1t3NViMmTz6DgxZZu/M=; b=DgDbfwhn7msyPhUotzQQ9doD/ pEXHTdlLf1/btV1BvyiWL0+gE+8s7JY8+4SohC2Ytg7WENxySbeisGEbqtuwEeUEaZ8jJJmhy1cw/ udjxvp8Hy9ob8vsbcg3k9csEhQa3CwtvLDtHAHPds8Ol/2lSlU+9XHPEVhqTrcAxDStJAk82uzc/7 OhGTEYHnnyt1s4wyiWrh1Qw1kj19n7/M1S8Wnz9YsXDtFtmPb4g4RUmyAiaMcxfQT96FoOkXH2g02 DC2tHJmSEODwvxsOoHACagA+P79qmLwU/IVw+eAsZ12tchacM+/rJFL5FbVVQ32YkhZjoxV+gz4OE FaxzgP6Yg==; Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fo2RP-0000gJ-I8 for linux-arm-kernel@lists.infradead.org; Fri, 10 Aug 2018 08:06:37 +0000 Received: by mail-wr1-x444.google.com with SMTP id r16-v6so7438928wrt.11 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=En53vpuc4IkUIOw2dFR3JLHw3nimwxrZJngMjLWejbZR/wRLG1fn04oY1TPAAXrhnM mN+zq+JdB4Kf+MT2DPL53sM/Mg+GYw8fyhUnyoDT77CuI6jvPfATAkfYkEmeqrMU6eFh Tit6P90EuA3mth9Vxgi0cFdDbixUq+5QGgq3LnqXZwHZXE20EzCj/voo74IiNkHWD+iO t/Av7EzCTevq2PL+uoZhgvvrblHLAUpxkm2Kz2WzLKEdtV/UEE7c7TLrlIQxq4FR2xr6 rJnKp1R7ABn8iMJ/oz//k53PCKvJkK1r5bPgO6qpM8AY0dNsHx95YPJkdUFDCrza7Ghj dabg== X-Gm-Message-State: AOUpUlGCR7oIFsv+OYLjWjBRkxSmTzHmg7RmMrILVWY8ckEptJ4l/JhN 2ZyLFO2KA4YxsVypSkbjxQ5tKA== X-Google-Smtp-Source: AA+uWPxuqh/WxcGPymRkgSu0vbbQ4dytEzxPxe01XX8anns4D3ycRy4utWPzmEfNdqIHaqB7Mq+Row== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180810_090635_616115_7366F349 X-CRM114-Status: GOOD ( 21.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-i2c@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 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();