Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2849805imu; Sun, 6 Jan 2019 11:30:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN7y1AUd0gzRbC8U8EJNfPinW97PlPsrsfPeGGuS07+XPiXkpoMWUM61KgvewPFhIXWKbs87 X-Received: by 2002:a17:902:6e0f:: with SMTP id u15mr57809375plk.175.1546803053411; Sun, 06 Jan 2019 11:30:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546803053; cv=none; d=google.com; s=arc-20160816; b=igZZATTbpVlTdE6zgYiDoMF9BGS/+ru+4GQZN/1Z6tTPqJ2amTqWPQobA4SyAvE194 kcp7sJUp5TfBBZtisA4a7HGw4ZMZOmiglt7cxbvFCHRe1MzpUPm/qHJzN7IxhAbDeiKA tuDSkxpXlG7h6KeLvYqS/LsMNU6Vy9TKyl96R16thhEFKZdwHklJLGaY9p80UFs0U3uL s1lmh7eLBJf2CvQ4n71TuncvKMAvQG11X8wj5BHLP4OPjLzm8KfOwkv5xkuOlVTT/OKJ JmFQbcy0D9E+AZkBx+NEMHlY/Z0CQja5nAJgoX6yeDcBlOUojOViEsmcPxId2zqtkhPx Kqlw== 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; bh=ScdqfpSUj9DgAMwtLgg5/xPJUpRTaVUnrzlIZBSNEIA=; b=ufjI8NXgV0mcMKwj3S145zAaE8+Eps+6bPloOnui8j8+Mze6Tdiqwm7/i4D4iTFHy7 SZEfyw0ka2pdMzLbKj8l4OTArIkIlE854OssS0dw8qzrwgQwVnPH3grV/NYx9AaWHJRe tejg7u6zborVGFCS4HjlXWgS7TrpiO5RSYQeUGnXJxPdzWxVJatRbN0N3KuOcBwV7EFN PIPXBENzRjDNqUmKtOKlAtEIMvnGd0YBFY9D9PC0m341yMQ8kwlPrv+36zN3+CI2iEBC /QLL/G4BqNSXCNRITq6uzyFdfRoIneNkJFFxqtlR1852Sx+9+Wvfr2zFdt0IF5aXGH50 1fVw== ARC-Authentication-Results: i=1; mx.google.com; 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 s5si3156769plp.139.2019.01.06.11.30.38; Sun, 06 Jan 2019 11:30:53 -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; 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 S1726230AbfAFT2h (ORCPT + 99 others); Sun, 6 Jan 2019 14:28:37 -0500 Received: from smtp3-g21.free.fr ([212.27.42.3]:30987 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbfAFT2h (ORCPT ); Sun, 6 Jan 2019 14:28:37 -0500 Received: from localhost.localdomain (unknown [IPv6:2a02:8108:4840:8f74:143e:fcd5:beb7:2140]) (Authenticated sender: albeu) by smtp3-g21.free.fr (Postfix) with ESMTPA id ADD7F13F8C9; Sun, 6 Jan 2019 20:28:29 +0100 (CET) From: Alban Bedel To: Srinivas Kandagatla Cc: linux-kernel@vger.kernel.org, Alban Bedel Subject: [PATCH 1/8] nvmem: core: Set the provider read-only when no write callback is given Date: Sun, 6 Jan 2019 20:28:13 +0100 Message-Id: <20190106192820.12558-2-albeu@free.fr> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190106192820.12558-1-albeu@free.fr> References: <20190106192820.12558-1-albeu@free.fr> 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 If no write callback is given the device should be marked as read-only. While at it also move from a bit or to a logical or as that is a logical expression. Signed-off-by: Alban Bedel --- drivers/nvmem/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index f7301bb4ef3b..cf2e1091fe89 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -646,8 +646,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) config->name ? config->id : nvmem->id); } - nvmem->read_only = device_property_present(config->dev, "read-only") | - config->read_only; + nvmem->read_only = device_property_present(config->dev, "read-only") || + config->read_only || !nvmem->reg_write; if (config->root_only) nvmem->dev.groups = nvmem->read_only ? -- 2.19.1