From patchwork Fri May 11 11:06:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 135528 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp722309lji; Fri, 11 May 2018 04:12:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZodqDwxXNHSjIrE7cJfzKnMdpkjtRX66EE1bIlbiuvVqcQvkSAtpnZMqXacrngcjKCRila6 X-Received: by 2002:a62:ec18:: with SMTP id k24-v6mr5091769pfh.204.1526037146148; Fri, 11 May 2018 04:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526037146; cv=none; d=google.com; s=arc-20160816; b=v0bGFt8Nbs9b2kdrPGeNC82rJ2w3FHTrdYKwCeyD6+eYeTnqdoYrc5t9PGSczWlos6 EgVJCl5v6GcJ5eiNlA53uet1rdZ5cMGVc+MHbD7DuXKH8kpv6gbVhCUWldD3vGfM3vlB P3zZ5pNpOKPl5oq6EhYmc0qvfmxnIODvhwECmEC/eFk79/SRsbKV1Wq0fNnCmkJMaRlX 4gdIdttkk3BKu7CE9FFNe3vU/B2RoUipmUk/mBn4M4m/ALbMS1yRGYfGFsU8GWB3qrLl y3sasmYSZxDYL0t6yiFA94eM8T1u93ij12XEn1CMDlS6dqozzaR7ivDM2Sf74weNFiYO 5dyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=H0qz3G2Yf+qnI2Pb4BPJFyzQj57UjzkRbyWc8uQk8Mg=; b=OmoWePhgREiCrV8Tvd2bnZnqEK42y3p4Q9kiG7DsSC27pVes6bmJ7+js5STGGr87b9 2BTGs4+Nvli3OsG0Q4rgOg9iCPKx2OcviJQVcpZo8X7osh9e3VXHWfG86K5XTrFuRHyW 2964FXFM8c2BiEdplxleWxDkc9oKBxK0ZblFXs0JfFttZawGrkoH/VZXX9IaVY4MNzai NRNqCJ2SNtiKZx+q/YR1hw+gOkK44/C9Ac1GxDj/wHx1YFFETaJhxPEeOfBEYp/rtlv2 e27xQh9t97Tj/8Me+WG19R4QRMDrTbXDh8Mbu5qIFF4mnVETfxFc4KUSEFKNX8+K17lT 7d4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jaBGao1Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10-v6si3035584plo.150.2018.05.11.04.12.25; Fri, 11 May 2018 04:12:26 -0700 (PDT) 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=@linaro.org header.s=google header.b=jaBGao1Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753672AbeEKLMW (ORCPT + 29 others); Fri, 11 May 2018 07:12:22 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:53856 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753401AbeEKLJe (ORCPT ); Fri, 11 May 2018 07:09:34 -0400 Received: by mail-wm0-f68.google.com with SMTP id a67-v6so2114042wmf.3 for ; Fri, 11 May 2018 04:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H0qz3G2Yf+qnI2Pb4BPJFyzQj57UjzkRbyWc8uQk8Mg=; b=jaBGao1QX42V6f9SJylLu6sI4TdwcCpxhbxPXyVzD1WwX9uKENbRnWvYuXQfmqvDmL Z9VOKWD4yjcl+BI/yLJ3u2eakvju+QXtA/aaHQctuhdHj/MVbuqwiMNmSDaWs57Yg6Zu 35LpLP/CHK1/A0lcNBFSN9RmFBitoIz7B48W0= 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=H0qz3G2Yf+qnI2Pb4BPJFyzQj57UjzkRbyWc8uQk8Mg=; b=f94P2/yosCtTyN7GgkvS/OlBQw3EU0mfwk7IybADc1SUbDeyinKfHQalDlb13FJy0a CmS2i5mVb+nmt+RnmurgntOIGGVA5398mXGUzxBtOgIoiPPEjgsz3g991/cKTDcNTSTf dPtAOpkN8vRyKJJMSh5I5j45UpAuiJ6pLFWJ1WPQoh9UW9CLL4+CLntxf1EpIBhh/+p/ 5IgYQameAmdnH/IhMprMGGKSEVBYTYuIYsQWf7MvwII4O64N17lvY4qwmbOOecqHbJrF NmidmNb5U5l0woIUod1cu1Rfx58sBrf1u9fI2WT3a7EMKkisRwqwyuLytZdt0GysgZAs n1Gg== X-Gm-Message-State: ALKqPwdz+TEqiOraK9/U25Xeht9S4gG+teoOsaxx5nLZGWLAOqbuJx4B mO4xoi76/sg7+gg4BMsOLNzMKg== X-Received: by 2002:a1c:d810:: with SMTP id p16-v6mr1674905wmg.133.1526036973303; Fri, 11 May 2018 04:09:33 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id a129-v6sm714047wme.34.2018.05.11.04.09.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 May 2018 04:09:32 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Jerome Brunet Subject: [PATCH 4/8] nvmem: meson-efuse: remove econfig global Date: Fri, 11 May 2018 12:06:59 +0100 Message-Id: <20180511110703.4924-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180511110703.4924-1-srinivas.kandagatla@linaro.org> References: <20180511110703.4924-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jerome Brunet Having a global structure holding a reference to the device structure is not very nice. Allocate the econfig instead and fill the nvmem information as before Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/meson-efuse.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) -- 2.16.2 diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c index 71823d1403c5..2df9b0094f45 100644 --- a/drivers/nvmem/meson-efuse.c +++ b/drivers/nvmem/meson-efuse.c @@ -35,13 +35,6 @@ static int meson_efuse_read(void *context, unsigned int offset, return 0; } -static struct nvmem_config econfig = { - .name = "meson-efuse", - .stride = 1, - .word_size = 1, - .read_only = true, -}; - static const struct of_device_id meson_efuse_match[] = { { .compatible = "amlogic,meson-gxbb-efuse", }, { /* sentinel */ }, @@ -50,17 +43,27 @@ MODULE_DEVICE_TABLE(of, meson_efuse_match); static int meson_efuse_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct nvmem_device *nvmem; + struct nvmem_config *econfig; unsigned int size; if (meson_sm_call(SM_EFUSE_USER_MAX, &size, 0, 0, 0, 0, 0) < 0) return -EINVAL; - econfig.dev = &pdev->dev; - econfig.reg_read = meson_efuse_read; - econfig.size = size; + econfig = devm_kzalloc(dev, sizeof(*econfig), GFP_KERNEL); + if (!econfig) + return -ENOMEM; + + econfig->dev = dev; + econfig->name = dev_name(dev); + econfig->stride = 1; + econfig->word_size = 1; + econfig->read_only = true; + econfig->reg_read = meson_efuse_read; + econfig->size = size; - nvmem = devm_nvmem_register(&pdev->dev, &econfig); + nvmem = devm_nvmem_register(&pdev->dev, econfig); return PTR_ERR_OR_ZERO(nvmem); }