From patchwork Wed Feb 13 19:54:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 158247 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp470106jaa; Wed, 13 Feb 2019 11:54:52 -0800 (PST) X-Received: by 2002:ac2:411a:: with SMTP id b26mr1410845lfi.169.1550087692068; Wed, 13 Feb 2019 11:54:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550087692; cv=none; d=google.com; s=arc-20160816; b=nVm6iAQwGnL+TlMoeoVATNI98z2VBnjfbAj2oZgG2HqkBAG9kZq0hHsxgBsBJJQ0no AgDmn68/zsEIh/cqDsUiONch1NwDBi8yYEZL8nAeYwxHe0l448oGsdhNGErFNXe1JDOU ejulIwkGKc0lN3dvEL1Q0TvdvAJHtOfh6Mkz1q82KUrwFoQgnyOaB5gJAF29Y9BmuQ3H pZ9mJR0NaBnTq+a9clXGIbVzHcZa8J4Izyd97td3If/OzmEWRGxDt5ZXjpiXatEx5PPr /kgMOtyGElUk27ejfECJVwAdEVygrt50e5t6ISJNoOS0wUHN+YJIOhw2oc4Fak23DbGU gf3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nuXD6VM1wVFkPlHiS/tUPo5Gno6gYFdCgM2U6wJp148=; b=kA2OlEp6JOtrW/klUM32hhDQnnJT2lOjMVHwUzB6ngVF0SRuOmCfCxikh8QR31mTSB QtNflgU3yhShUItvSAtV9J+1w/bPSTq1E86xY2NP8dnQhRq9ItyKFEEQRZjCvCLJQhNt 2jDFv++gnhCJ4OsRi/l3Hk40jAqQhreO8VpPhna0Te+iLGXMAQdTeWV5xj35xtHQFJKj zkn2DRY6HHqAfE124n9CKeBZONHKQZ6DuUjkquZxL7UyJzXtdVU+eNqMOp10+G8xCZUf AKNui4x/Le8hAbRqSpyGwmOREbxxL1rMwRMqskQW4jsybM6aJRvqby9zAbXSyyw54g/N Iecg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gQGAf3Gl; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id r10-v6sor117760lji.40.2019.02.13.11.54.51 for (Google Transport Security); Wed, 13 Feb 2019 11:54:52 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gQGAf3Gl; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=nuXD6VM1wVFkPlHiS/tUPo5Gno6gYFdCgM2U6wJp148=; b=gQGAf3Gldetn56cN+l3X6/VjqQwekFIGuJVx0rPvM4AfgJUmfVAsQUw1/qtiWlUGqW 60PD++G3SjkKTTAANbJuRmA1YuVo+llbUsTBU5mAXtZLKkHgplVGF1jtbXBYuaNlDFsI WuO5cC0+MjT3aZYPQuuAcoMTWTVXUod6/gWeJGHUL0shDCYMjekkZLJ8UcOeevgpltyG FgzSrkiyOTSOtrSIM5Z9zXCLdXdyE+/2V/yWhheubXYGPidEpGhbcS8I42hXTDu7D4s0 RRSTx/WtRn8aUA7DdNJLTPkE0uauw/qFBf07gzOWFWM6d3V1nKYiXC33IfDQTFN0WrPl sBXw== 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=nuXD6VM1wVFkPlHiS/tUPo5Gno6gYFdCgM2U6wJp148=; b=peZgafWgU1OQyeCiKquEwt0MlRfpx+Nxgo0c50YynT4hv/M3ITcay6VGCd48Rv+rDK GnP8GMRwqCxe+wf0O39vjfjaC5/7ODVvJ4sOr+qcjExagczENGUhidqNm+2rLQ2F/lQa LIdWmSbt/Gsi44b+yy2Aql4LntklYfm9+6PIHmZsdE1yhGWQtfNrnv1ITjiekdcsVUkp 4wakqnashvstwb5kdBIOLjP3XWWdV+Ks7hakCkSXe9bo2nWrzNSMbec/4zeo2gvfV1VX /DjwS24nQHdZS5vlFzoBv2J8XZTGmTYR0kyvpPNzfFra5DCG8y/PQHCrV/X1f8jGyuxj GUlA== X-Gm-Message-State: AHQUAuY/2wInTgz0IKPQkVe8y+ZRPQ0xF923YQsTMDQZHSXIFBbvhqLe k83Wn9wGfPbr/ayze7drEaz8m7KJ X-Google-Smtp-Source: AHgI3IZ3RQxmiu507CYYdnR2wK9HjyFtlRJPmXOqXMg+8MLqYuLCCZ+uCsVPqCdtJ8SDPQcgmFIxMA== X-Received: by 2002:a2e:9a58:: with SMTP id k24mr1432875ljj.136.1550087691562; Wed, 13 Feb 2019 11:54:51 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id g194sm39169lfg.55.2019.02.13.11.54.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 11:54:50 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Adrian Hunter Cc: Ulf Hansson Subject: [PATCH 3/7] mmc: of_mmc_spi: Convert to mmc_of_parse_voltage() Date: Wed, 13 Feb 2019 20:54:39 +0100 Message-Id: <20190213195443.18935-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190213195443.18935-1-ulf.hansson@linaro.org> References: <20190213195443.18935-1-ulf.hansson@linaro.org> Let's drop the open-coding of the parsing of the "voltage-ranges" DT property and convert to use the common mmc_of_parse_voltage() API instead. Signed-off-by: Ulf Hansson --- drivers/mmc/host/of_mmc_spi.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index b294b221f225..8a274b91804e 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c @@ -61,9 +61,6 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) struct device *dev = &spi->dev; struct device_node *np = dev->of_node; struct of_mmc_spi *oms; - const __be32 *voltage_ranges; - int num_ranges; - int i; if (dev->platform_data || !np) return dev->platform_data; @@ -72,25 +69,8 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) if (!oms) return NULL; - voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges); - num_ranges = num_ranges / sizeof(*voltage_ranges) / 2; - if (!voltage_ranges || !num_ranges) { - dev_err(dev, "OF: voltage-ranges unspecified\n"); + if (mmc_of_parse_voltage(np, &oms->pdata.ocr_mask) <= 0) goto err_ocr; - } - - for (i = 0; i < num_ranges; i++) { - const int j = i * 2; - u32 mask; - - mask = mmc_vddrange_to_ocrmask(be32_to_cpu(voltage_ranges[j]), - be32_to_cpu(voltage_ranges[j + 1])); - if (!mask) { - dev_err(dev, "OF: voltage-range #%d is invalid\n", i); - goto err_ocr; - } - oms->pdata.ocr_mask |= mask; - } oms->detect_irq = irq_of_parse_and_map(np, 0); if (oms->detect_irq != 0) {