From patchwork Sun Jun 9 22:15:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 17709 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CD3BA25DFB for ; Sun, 9 Jun 2013 22:16:01 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m13sf5740629yen.9 for ; Sun, 09 Jun 2013 15:16:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=L1LGc0tkAQi/7zAu4kCs7BimwLupzO2XSzJyztB3QmY=; b=W7olPkucuPKE53ghtOEBfeL/AOAswEzoFStzcHrOWxo1fWF8ag1veZSzZfrcQTPNtu m1GI28Yf7KAxBOQ0eWgLSwV+VEdnkPA/G8TuUXtkQ7cyR6xv+aZFwkfSN5rYp9GewQ9T di23+XqCpkkdxbT7xQ/I5jB4K5xsvhwIBaCi/ol+WRJ5LeR2JvZoHniw0jy0pR8rZeRB l0+NpJCUXD7jvihyHap6olx5RmIVwJAfRufECuoRtD0s2xys9RZGg6JsehCwmhfSqzkc xhvZmXJ3V8HDvDLeEaYYuyzkfGq6hu4r5RkQzQ1S1HZ4L69uS965oy5bhgFW/gXM/1yX HCow== X-Received: by 10.224.200.202 with SMTP id ex10mr6980018qab.8.1370816161260; Sun, 09 Jun 2013 15:16:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.98.2 with SMTP id ee2ls2632841qeb.11.gmail; Sun, 09 Jun 2013 15:16:01 -0700 (PDT) X-Received: by 10.220.7.134 with SMTP id d6mr4145853vcd.56.1370816161030; Sun, 09 Jun 2013 15:16:01 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id tn5si3856480vdc.26.2013.06.09.15.16.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Jun 2013 15:16:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf11so3158770vcb.26 for ; Sun, 09 Jun 2013 15:16:00 -0700 (PDT) X-Received: by 10.52.36.115 with SMTP id p19mr3551283vdj.8.1370816160824; Sun, 09 Jun 2013 15:16:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp48633vcb; Sun, 9 Jun 2013 15:16:00 -0700 (PDT) X-Received: by 10.152.3.102 with SMTP id b6mr3751945lab.22.1370816159587; Sun, 09 Jun 2013 15:15:59 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx.google.com with ESMTPS id o7si4142848lae.175.2013.06.09.15.15.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Jun 2013 15:15:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.171 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id 13so2460895lba.2 for ; Sun, 09 Jun 2013 15:15:58 -0700 (PDT) X-Received: by 10.112.235.104 with SMTP id ul8mr5256961lbc.36.1370816158811; Sun, 09 Jun 2013 15:15:58 -0700 (PDT) Received: from localhost.localdomain (c83-249-209-231.bredband.comhem.se. [83.249.209.231]) by mx.google.com with ESMTPSA id p16sm4634114lbi.13.2013.06.09.15.15.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 09 Jun 2013 15:15:58 -0700 (PDT) From: Linus Walleij To: Wolfram Sang , linux-i2c@vger.kernel.org Cc: Linus Walleij Subject: [PATCH] i2c: nomadik: allocate adapter number dynamically Date: Mon, 10 Jun 2013 00:15:53 +0200 Message-Id: <1370816153-9838-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-Gm-Message-State: ALoCoQm9y1yk7o4KVgrMLKyUAU+E+/jnIphlkGk4Kx8FABHMVh6VC/GjsBtUCUsbw7n67IpFLO87 X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The Nomadik I2C was using a local atomic counter to number the I2C adapters. This does not work on configurations where you also add, say a GPIO bit-banged adapter to the system. They will start to conflict about being adapter 0. There is no reason to use the numbered adapter function, and the semantic effect on systems with only Nomadik I2C blocks will be none - instead of increasing the number atomically in the driver itself, it is done in the I2C core. Signed-off-by: Linus Walleij --- drivers/i2c/busses/i2c-nomadik.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 9f1423a..96c8515 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -981,8 +980,6 @@ static void nmk_i2c_of_probe(struct device_node *np, pdata->sm = I2C_FREQ_MODE_FAST; } -static atomic_t adapter_id = ATOMIC_INIT(0); - static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) { int ret = 0; @@ -1095,10 +1092,9 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; adap->algo = &nmk_i2c_algo; adap->timeout = msecs_to_jiffies(pdata->timeout); - adap->nr = atomic_read(&adapter_id); + adap->nr = -1; snprintf(adap->name, sizeof(adap->name), - "Nomadik I2C%d at %pR", adap->nr, &adev->res); - atomic_inc(&adapter_id); + "Nomadik I2C at %pR", &adev->res); /* fetch the controller configuration from machine */ dev->cfg.clk_freq = pdata->clk_freq; @@ -1113,7 +1109,7 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) "initialize %s on virtual base %p\n", adap->name, dev->virtbase); - ret = i2c_add_numbered_adapter(adap); + ret = i2c_add_adapter(adap); if (ret) { dev_err(&adev->dev, "failed to add adapter\n"); goto err_add_adap;