Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4512472imu; Tue, 8 Jan 2019 01:18:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN6/JKPf/tBMXosdmd3CrXdqxwbtyUgRd/9ADUBfNt3/Z0ubVoVI7VCIYI51d6caCl32Jcv8 X-Received: by 2002:a63:2b01:: with SMTP id r1mr821476pgr.432.1546939106421; Tue, 08 Jan 2019 01:18:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546939106; cv=none; d=google.com; s=arc-20160816; b=l0BNQ94fEJ2j8y1HGvXS/KwpVc44PQcWfVGFBYiL+crlhnR32j046sxQrb+tnkBrHa 7bPCR0NA6wiuritIzRdxR0J6LLURCs07vdloqOQVUUpYHEvDmiJ6Wo/J5yaP7ePpqq4t PgHLATWVvkYBfIxqYVSlvwZLcBDi8aaHbm1sPd2rJ2NVHr89dhv78FG6CdsbdmSz3XBX SAT6WKn/c8EEjZsuA+2VoJwVV2SOWg9fC9iLMnjA1yWLeZdaO+08h3HRgvNxTZUNkM+M dgrJ/R5porawcfPWBYRdzLFjnhC1HejVcwm8SkpXQUGJH2qJIQFoSrbVs2uAkSGahKFK Tndw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=syCNYOhWI2Fa3CkPeYThsu7drj9CGAM/9EZeMe/84fg=; b=qcpiyRgqCuMgbhZr1kfQ5ZHHldFR3bKOQbmLwp08mql5bzx1QpcHy8BkmADsy9b9Hy 1aD7eS0M8gok3AV315f5LL0KTVPsvS6j9t3+4jJvJ4xOpyWr+mwIU4/wB3Um4xdPj+KE opDtgEgtpDFjIFKdydPG5l8irzJ5/ncjSq5wwilN5P3nTBYk5BhAJIzAj3zOLMpV181o F3NjOZNolfMuc+sqO+gTvi/IAqKstpH2cMOYernnYYK3L6OeZFZw9Gt3hBB8PFyORO6w XooHhimf4iNLjMZKFDs71x9h64bol+ZUC1i/JR9tamtvAg77jleo+Iuv2Stmo0Ve6d2C UnOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=mscUU3ZW; 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 n18si67641277pfj.30.2019.01.08.01.18.11; Tue, 08 Jan 2019 01:18:26 -0800 (PST) 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=mscUU3ZW; 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 S1728465AbfAHJQk (ORCPT + 99 others); Tue, 8 Jan 2019 04:16:40 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:33574 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728253AbfAHJQE (ORCPT ); Tue, 8 Jan 2019 04:16:04 -0500 Received: by mail-ed1-f67.google.com with SMTP id p6so3498575eds.0 for ; Tue, 08 Jan 2019 01:16:02 -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=mscUU3ZWKPFNJHUEfNCsIH9Q6oMXrfnX4GjoBcDTTRTCfpTqqskB8ocUk3JJS6f7nH F1QPu6fR0Qc/E10AyfaUCOcJ9Jn3owXgOnusdSM3Wa953EWG+ixmUezdY1iXoo3X/SAM Y+tqYuuJrzNetOMRfLn62Ki31x5ODVN8O+Tassm3sW7pgpIBNeMPIRgJr7s2e6UkIGCz 05PF/B9vBpQp++4E3934cLafg0iezy9iHXPYypudW6fD29Et8K6rxh18Ni12NwuXSOfU shPXkmpCuR1BbJCz+O4a6UyJ8su0KQPQ2ye74GXElSqM92Aifsb53Ao4lkBtES/sQZ0c uOhg== 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=A98dGcmNGlI3q+u3p/TM4SoPcVe9WP3MjTDNKf5dMG2U/tJC+KPe53/cmbbp0QottM TyISxqj118rHLq0zd2aPhVHwXYWPcDXSBbOei8OlK+CF5Ca995UqicPi5uZjALJv+pbm +0cvDyCy3M0WjAhcTjzhHnmwsSf1IU/GO3eFu/8UiqHlij2yU0d53MOgTfkQes096ErV qa+Bto7vlHi+65ouiiNPtK1a2ZuEcFbk7ZpFsATQZYyhi/3DZY75kH+M9sooPLFhnE1u a83rZfFhiiLQrl8f5NLto5cmRBwY+6rWuhBt87eme+dH8XKYpV/rpSZp8Y0IP3I6p+4c Wj5w== X-Gm-Message-State: AJcUukfaJhz3znhNO2r8gHNEhBqTxM3pREOkm7TFfeq8tfw+jkaFhqb1 CHOOR+7tuQA5fJGEqmFWoR1G5A== X-Received: by 2002:a17:906:5202:: with SMTP id g2-v6mr1163630ejm.139.1546938962046; Tue, 08 Jan 2019 01:16:02 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id gp22-v6sm18373560ejb.4.2019.01.08.01.16.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jan 2019 01:16:01 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Arnd Bergmann , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, Bartosz Golaszewski Subject: [RESEND PATCH 10/12] ARM: davinci: mityomapl138: use nvmem notifiers Date: Tue, 8 Jan 2019 10:15:37 +0100 Message-Id: <20190108091539.16674-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190108091539.16674-1-brgl@bgdev.pl> References: <20190108091539.16674-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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); -- 2.19.1