From patchwork Sat Jun 15 20:38:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 17931 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CF13B25DF7 for ; Sat, 15 Jun 2013 20:38:26 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id hu16sf1783038qab.8 for ; Sat, 15 Jun 2013 13:38:26 -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=l1dhF0/yXxQ6KwrxlN+VNjBObc5o5mGYOVj/M9WjPQY=; b=NgdzBv0acqsNQTwo6aZvtrr55krToGipWJL2qcFbYlvUkgkel1kbmlH+2m9s5D5qmE GsgwItzp7SHM6sHjlv7Fyiw5Fj/jIJWnfjrkmsGUI7ucUCJSEQPsWDybqX/osZ0cLZtr EvtPZpm/jrxxvscWrZDH6wK535ZeSANTFAaGGUzdXTiZZAgnpsJ7Dc/9nr8cXtB+/gkb iRt6l/ZWuhq+hnYjt8CQv23ib0FVuznIxvjbF+V6wC6NXifziu4k0dxE7aCaW4XOhtwa u1E/0UlFj6wRsn+J31GAhmOpR9+JbWGiZxoE13jrQ/3FgB/jaTIG4uflx453cYNOuPIT SDLg== X-Received: by 10.224.200.202 with SMTP id ex10mr4101221qab.8.1371328706323; Sat, 15 Jun 2013 13:38:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.105.7 with SMTP id gi7ls666336qeb.56.gmail; Sat, 15 Jun 2013 13:38:26 -0700 (PDT) X-Received: by 10.220.104.135 with SMTP id p7mr2635382vco.10.1371328706145; Sat, 15 Jun 2013 13:38:26 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id zt2si2559509vdb.11.2013.06.15.13.38.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 15 Jun 2013 13:38:26 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.179 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.179; Received: by mail-vc0-f179.google.com with SMTP id hz11so1187526vcb.38 for ; Sat, 15 Jun 2013 13:38:26 -0700 (PDT) X-Received: by 10.220.105.9 with SMTP id r9mr2645431vco.60.1371328705950; Sat, 15 Jun 2013 13:38:25 -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.58.191.99 with SMTP id gx3csp20966vec; Sat, 15 Jun 2013 13:38:25 -0700 (PDT) X-Received: by 10.152.18.202 with SMTP id y10mr3646594lad.80.1371328704440; Sat, 15 Jun 2013 13:38:24 -0700 (PDT) Received: from mail-la0-x232.google.com (mail-la0-x232.google.com [2a00:1450:4010:c03::232]) by mx.google.com with ESMTPS id qg10si3516385lbb.150.2013.06.15.13.38.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 15 Jun 2013 13:38:24 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4010:c03::232 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=2a00:1450:4010:c03::232; Received: by mail-la0-f50.google.com with SMTP id dy20so1418215lab.9 for ; Sat, 15 Jun 2013 13:38:23 -0700 (PDT) X-Received: by 10.152.20.40 with SMTP id k8mr3777446lae.25.1371328703089; Sat, 15 Jun 2013 13:38:23 -0700 (PDT) Received: from localhost.localdomain (c83-249-208-143.bredband.comhem.se. [83.249.208.143]) by mx.google.com with ESMTPSA id x5sm2854661lbx.8.2013.06.15.13.38.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 15 Jun 2013 13:38:22 -0700 (PDT) From: Linus Walleij To: Wolfram Sang , linux-i2c@vger.kernel.org Cc: Linus Walleij Subject: [PATCH v2] i2c: nomadik: allocate adapter number dynamically Date: Sat, 15 Jun 2013 22:38:14 +0200 Message-Id: <1371328694-2073-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-Gm-Message-State: ALoCoQlkJ54xDkTqJkhXrK56qc4bVBXVHjZnu1Zs9L10PYWxXrDEKP7bJl65nbYY2jiaIMtJUOx8 X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 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 --- ChangeLog v1->v2: - Drop the default assignment if -1 to adap->nt as we're now using i2c_add_adapter(). --- drivers/i2c/busses/i2c-nomadik.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 9f1423a..063e726 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,8 @@ 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); 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 +1108,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;