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: 10562379 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 8B1E8157B for ; Fri, 10 Aug 2018 08:06:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B96C2B575 for ; Fri, 10 Aug 2018 08:06:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F90E2B5A2; Fri, 10 Aug 2018 08:06:53 +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 0F6362B575 for ; Fri, 10 Aug 2018 08:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729209AbeHJKfL (ORCPT ); Fri, 10 Aug 2018 06:35:11 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:45140 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729215AbeHJKfL (ORCPT ); Fri, 10 Aug 2018 06:35:11 -0400 Received: by mail-wr1-f68.google.com with SMTP id f12-v6so7433297wrv.12 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=uLEcUlt9wErL4MFoBk8rpZM5ZJxsNmVROfoSkHcXE7NDyzXXHKEZXgSsPGBKHwn/xB ewGLinBw9ms7KUY2rL3IkB9yo1KHeWDtI9SaBOiXepRhx2yQxQYCnhN3Dt8I/X3YCxz8 p6iA29utRh3QAgxQJjYtqGnFMy5tVUZp+FAElyJzLVdsCFOVNDn7mj7TOmhn+pJ1CoLq CyFMhgMh3pM59I1xeOkg4VWWU5R404dzU5lHCAunQdvubbnVz04JRKU2fUHdZk5EkQNn syqd+cACzlndLWez6fUcMZg4ZJVdxxW3/6Dx/59irRk2PY9uvidPKvORUiy1BYpVeTPN dWng== X-Gm-Message-State: AOUpUlFQSLUR5s9pVS72cfDHpMm32cBIDBQJwe/o/DV5j6ZB49jk0C3g zdWR8nJyH+pe7S3XLcEGMbsYjA== 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 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-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 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();