Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1536405imm; Sat, 2 Jun 2018 03:19:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKqBLoE+gfmg8oc50YHlSIy2gTmlQ3vF1SJHTwWeKT3VqJnCZvaB/F7BAy/lw/UxocWtn9F X-Received: by 2002:a63:5ec4:: with SMTP id s187-v6mr11339446pgb.72.1527934742525; Sat, 02 Jun 2018 03:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527934742; cv=none; d=google.com; s=arc-20160816; b=R7HZQE4Ne8zOnOhoLUyc7pXRvzUTOMs4cNLQhJqlljgOxaqOThZqI+jIPnx/qQhfnE ZNSRItiuBIkQguC+PV4f9mPOQlROQfMmSy7C0/2lkxRV5MB/SRMvstDA4Nf3D7KrRwPV k8L6B2XCQleOoeEW5pMZVXyBF5rSLutikeq76hmJ/j5tZ0v1YY4yrcPM9da7Wja2PCW5 Y4Hxj+2zD8oO9dVuI5+10zaRXhpUYIGQx0BjBv1q0jQGcB/eNFKeIvUwS9g+5LzcczsE ssU/enRqhTG6xPVhsIcsWuRMHiC9RVKPuWjFAOX3eJhbfP3NhMXXmfYiw7oBOZfD+FyX V2mw== 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=FY6ZPqMfWu2ICYrmzT+4M0Ee7tuv4LuV0MUU/6tKUks=; b=X1FLXj0fIi2aukH+uXCtJSNI4mlWwVLZqS17Nt0f5zK8JWHV894Hmm1MMlNNtWdbwk dJkM+C/XuzVBgV9BxbIZt9NwnyS5aU3Rk+QqB+PTb+UwHuSjPnY94geYcqmO5a0+p0vf dMGDYDURNw+AIAGazvUvHuiBx/WrUF5iVSF4s064TrBpyHgQcyFlPVQUy1bs90yajtPv blJsdUpa/VA/11/jLPXuVJhfYb/Du8Fh275VF89sVDuREZ5WeaoHeOe4RIZl5B+Bplph 8h5G2U0CxGQ4wxqHdM51DR7dWAvX41fFV0FamlgWYqVJMqUVpOlTS91C4s3rgJcXkYcZ Z3iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vbQqJuec; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14-v6si18959081ply.102.2018.06.02.03.18.17; Sat, 02 Jun 2018 03:19:02 -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=@gmail.com header.s=20161025 header.b=vbQqJuec; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751775AbeFBKMe (ORCPT + 99 others); Sat, 2 Jun 2018 06:12:34 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:46926 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751376AbeFBKMU (ORCPT ); Sat, 2 Jun 2018 06:12:20 -0400 Received: by mail-wr0-f194.google.com with SMTP id v13-v6so26816369wrp.13; Sat, 02 Jun 2018 03:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FY6ZPqMfWu2ICYrmzT+4M0Ee7tuv4LuV0MUU/6tKUks=; b=vbQqJuecaGOyL0PeX6UoHvAa7Zw0j7Ckxlse86ogIs5Bh+Cwka0gpGF3iCSos/aVZ7 MJljEU8DiLOscoyOORbsFsliloVkuqSEJoPpTW3R3IaxoTMd0TcaCeN/VuQJ049i0419 EbHqikZLOaLWgC7VAGWLTR1AE5U+mpfoqokIzkh1bo38+3/RHrTwOmToMBnhayjC5Y3V iZPkhjLTva+buGzRItaeONjZuhnN27dgvOScoKeCt/iibwa+K3l5dx7fqyEwFXqnb3Cx 1FaphcSZxohOkSSyLCQcJLgSYqAfepHilOwQU3bUfR6EpqZyyCF3uIJUQ+9wPMqhQlDi y+dA== 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=FY6ZPqMfWu2ICYrmzT+4M0Ee7tuv4LuV0MUU/6tKUks=; b=gq9eOLPMlNJnNUPrf7vjh7C2Gfu8hcuk/FhhypupnIuP6OYtuCrhX7gZOC+4+anPUr 8yOI4Up+AvWh9wwHcbGHkSkSaCtrpnAAfh+jAhL+6Gaj+YhnvaYfPYUwJTYVnbfeanuz oFF3LjDmEzLUsKNiVU9Ut351lyHf1ckEuGIMIRJGQscZ8isfUI6fB4MWLYfZ5YgXQUyE lPODwnJ6mVVJ2wCEK8Od8r8xPpETwh/5/LyViKvkFwHbWN+QNEGF4U7xWrZSx+2kuJCU JpKS4uLhxiNDdA/IaWOg0Hj/vizNmhE+r2JhsTVGeDtz1P1OmDPnpnAHMsCgbCj7xRbo b9mQ== X-Gm-Message-State: ALKqPwcuyJDemEA4CIyd2wSI0gBDg2T3Il+Wu0y2GXdv9rG4jCUFMYak 6FKuaoRWPmVMzuwuIWQAWp+Q+k0/ X-Received: by 2002:adf:e687:: with SMTP id r7-v6mr10635250wrm.14.1527934338500; Sat, 02 Jun 2018 03:12:18 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id b16-v6sm38624797wrm.89.2018.06.02.03.12.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 03:12:17 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-kernel@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Lee Jones , Mark Brown , Steve Twiss , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH v3 04/10] mfd: da9063: Replace model with type Date: Sat, 2 Jun 2018 12:11:49 +0200 Message-Id: <20180602101155.26375-4-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180602101155.26375-1-marek.vasut+renesas@gmail.com> References: <20180602101155.26375-1-marek.vasut+renesas@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The model number stored in the struct da9063 is the same for all variants of the da9063 since it is the chip ID, which is always the same. Replace that with a separate identifier instead, which allows us to discern the DA9063 variants by setting the type based on either DT match or otherwise. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Lee Jones Cc: Mark Brown Cc: Steve Twiss Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org Acked-by: Mark Brown Reviewed-by: Geert Uytterhoeven --- V2: Drop useless cast of id->driver_data V3: Fix kernel 0day error , s/dev_model/type/ --- drivers/mfd/da9063-core.c | 1 - drivers/mfd/da9063-i2c.c | 5 +++-- drivers/regulator/da9063-regulator.c | 6 +++--- include/linux/mfd/da9063/core.h | 6 +++++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c index fb122316c421..eebca3442cf3 100644 --- a/drivers/mfd/da9063-core.c +++ b/drivers/mfd/da9063-core.c @@ -215,7 +215,6 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq) return -ENODEV; } - da9063->model = model; da9063->variant_code = variant_code; ret = da9063_irq_init(da9063); diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c index 7f84030c8d53..048ce55ebc5b 100644 --- a/drivers/mfd/da9063-i2c.c +++ b/drivers/mfd/da9063-i2c.c @@ -236,7 +236,7 @@ static const struct of_device_id da9063_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, da9063_dt_ids); static int da9063_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { struct da9063 *da9063; int ret; @@ -248,6 +248,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, da9063); da9063->dev = &i2c->dev; da9063->chip_irq = i2c->irq; + da9063->type = id->driver_data; if (da9063->variant_code == PMIC_DA9063_AD) { da9063_regmap_config.rd_table = &da9063_ad_readable_table; @@ -280,7 +281,7 @@ static int da9063_i2c_remove(struct i2c_client *i2c) } static const struct i2c_device_id da9063_i2c_id[] = { - { "da9063", PMIC_CHIP_ID_DA9063 }, + { "da9063", PMIC_TYPE_DA9063 }, {}, }; MODULE_DEVICE_TABLE(i2c, da9063_i2c_id); diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 87c884ae0064..eeb0d431dda1 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -98,7 +98,7 @@ struct da9063_regulator_info { struct da9063_dev_model { const struct da9063_regulator_info *regulator_info; unsigned n_regulators; - unsigned dev_model; + enum da9063_type type; }; /* Single regulator settings */ @@ -585,7 +585,7 @@ static struct da9063_dev_model regulators_models[] = { { .regulator_info = da9063_regulator_info, .n_regulators = ARRAY_SIZE(da9063_regulator_info), - .dev_model = PMIC_CHIP_ID_DA9063, + .type = PMIC_TYPE_DA9063, }, { } }; @@ -741,7 +741,7 @@ static int da9063_regulator_probe(struct platform_device *pdev) /* Find regulators set for particular device model */ for (model = regulators_models; model->regulator_info; model++) { - if (model->dev_model == da9063->model) + if (model->type == da9063->type) break; } if (!model->regulator_info) { diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h index 664f650d0086..eb234582dcb2 100644 --- a/include/linux/mfd/da9063/core.h +++ b/include/linux/mfd/da9063/core.h @@ -31,6 +31,10 @@ #define PMIC_CHIP_ID_DA9063 0x61 +enum da9063_type { + PMIC_TYPE_DA9063 = 0, +}; + enum da9063_variant_codes { PMIC_DA9063_AD = 0x3, PMIC_DA9063_BB = 0x5, @@ -76,7 +80,7 @@ enum da9063_irqs { struct da9063 { /* Device */ struct device *dev; - unsigned short model; + enum da9063_type type; unsigned char variant_code; unsigned int flags; -- 2.16.2