From patchwork Tue Nov 13 14:01:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10680721 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 CD9DF14DB for ; Tue, 13 Nov 2018 14:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB9382A900 for ; Tue, 13 Nov 2018 14:02:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B92E12A9BD; Tue, 13 Nov 2018 14:02:41 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 502892A900 for ; Tue, 13 Nov 2018 14:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388155AbeKNAAz (ORCPT ); Tue, 13 Nov 2018 19:00:55 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39378 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388154AbeKNAAy (ORCPT ); Tue, 13 Nov 2018 19:00:54 -0500 Received: by mail-wm1-f67.google.com with SMTP id u13-v6so11540625wmc.4 for ; Tue, 13 Nov 2018 06:02:36 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=syCNYOhWI2Fa3CkPeYThsu7drj9CGAM/9EZeMe/84fg=; b=PJL8eMa9+jAOQEZNJcbJMuSBrsGHEjmzI10SPdojyC87xlN5V9crDDWQ+lH3v/VzOM 1BgbUtHLRcXfw/YhVhc1RMPR1tHbbr2h2C490+AKByKBjNr5cdg0KaSMeQ2FXZ3djCDX WT6Ys3rYvkQbowoqMbQhCP6WyvgYuMh3LVETsVbCH14uid6zYbfsgiJgv/1Gdx3TjQco dEjOKY9M6u1ZSaJ7RFTHKm9BhVsHRDywikCx2ORM+ukOBDPEiUcYp9J8RjeXrLgxxrv6 WHI8fixQ+evqM5Ip9WfK8/u4WR2v+o8N/UryB/bOM8UPhppphIXf4VLR9ztQb3dMp4Q+ VXDg== 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:mime-version:content-transfer-encoding; bh=syCNYOhWI2Fa3CkPeYThsu7drj9CGAM/9EZeMe/84fg=; b=YqgcnDGz18vRzp0WGA1f5WsYAZ2mYaaaD9VDbeP0VzNpAgXShIQySmRk4JqAgYHloz sKVW1nQXajq8ju0Bx767NOSPDEeEH957B/JE1jXet2k2MGsRDCilCaPN5Pjx8flOuZkJ RJv1wvdPKrxKdDNSYB5cWuFanQ9BJsGISQAq31Wux0eRc1bpwesLGHZ7Dgyrxv30J9BS OmXeggKBpQxEvE2aXyi5wbVDiIofCJpcwQ9RtN2D8hI8pTGEoWove8IiZQL6b9Inz8+w Ilqzg9zdSWkXQIcZgSJ4jOT+4Mdf0V8GcYULvRab4xX4UW4a6qtJ1+qXAyFyIMm3rlgU UtvQ== X-Gm-Message-State: AGRZ1gKH1GbkdO5Wr1hKtRRNkc1NND05Z+SVv/FfoJ+4Q5+54gHFraWY BqqsN4VZLyAKPjTsZcRg1xFIiITUjMY= X-Google-Smtp-Source: AJdET5ePKezX6JsMVmB21bIh2rzVp1xhzc1G5EZ2Oj5DB2QjqGjdRdYo3Cs8BUYnOEw6tUiFG4ab/A== X-Received: by 2002:a1c:5f85:: with SMTP id t127-v6mr3313396wmb.44.1542117756310; Tue, 13 Nov 2018 06:02:36 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id m69-v6sm16604122wmb.8.2018.11.13.06.02.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 06:02:35 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Nicolas Ferre , "David S . Miller" , Grygorii Strashko , Srinivas Kandagatla , Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand , Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 23/25] ARM: davinci: mityomapl138: use nvmem notifiers Date: Tue, 13 Nov 2018 15:01:31 +0100 Message-Id: <20181113140133.17385-24-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181113140133.17385-1-brgl@bgdev.pl> References: <20181113140133.17385-1-brgl@bgdev.pl> MIME-Version: 1.0 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 3286dc2457a5..ac1a1699d185 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 @@ -117,10 +119,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"); @@ -152,8 +159,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, +}; + /* * We don't define a cell for factory config as it will be accessed from the * board file using the nvmem notifier chain. @@ -183,8 +196,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 = { @@ -561,6 +572,7 @@ static void __init mityomapl138_init(void) davinci_serial_init(da8xx_serial_device); + nvmem_register_notifier(&mityomapl138_nvmem_notifier); nvmem_add_cell_table(&mityomapl138_nvmem_cell_table); nvmem_add_cell_lookups(&mityomapl138_nvmem_cell_lookup, 1);