From: Benson Leung <bleung@chromium.org>
To: wsa@the-dreams.de, mika.westerberg@linux.intel.com,
khali@linux-fr.org, andriy.shevchenko@linux.intel.com,
jacmet@sunsite.dk, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: dlaurie@chromium.org, bleung@chromium.org
Subject: [PATCH v2 2/2] i2c-designware-pci: Index Haswell ULT bus names from 0
Date: Mon, 21 Oct 2013 08:05:44 -0700 [thread overview]
Message-ID: <1382367944-3005-3-git-send-email-bleung@chromium.org> (raw)
In-Reply-To: <1382367944-3005-1-git-send-email-bleung@chromium.org>
Rather than having the bus names be "i2c-designware-pci--1" because
we have set the .bus_num to -1 to force dynamic allocation, lets have
the busses named "i2c-designware-pci-0" and "i2c-designware-pci-1"
to correspond to the correct names of these busses.
The adapter number will still be dynamically assigned.
Signed-off-by: Benson Leung <bleung@chromium.org>
---
v2: Fixed warning.
v1: Initial
---
drivers/i2c/busses/i2c-designware-pcidrv.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 816cbd1..0c6771d 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -229,7 +229,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
{
struct dw_i2c_dev *dev;
struct i2c_adapter *adap;
- int r;
+ int r, adapter_num;
struct dw_pci_controller *controller;
if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers)) {
@@ -287,8 +287,18 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
adap->algo = &i2c_dw_algo;
adap->dev.parent = &pdev->dev;
adap->nr = controller->bus_num;
+
+ switch (id->driver_data) {
+ case haswell_0:
+ case haswell_1:
+ adapter_num = id->driver_data - haswell_0;
+ break;
+ default:
+ adapter_num = adap->nr;
+ break;
+ }
snprintf(adap->name, sizeof(adap->name), "i2c-designware-pci-%d",
- adap->nr);
+ adapter_num);
r = devm_request_irq(&pdev->dev, pdev->irq, i2c_dw_isr, IRQF_SHARED,
adap->name, dev);
--
1.8.3.2
next prev parent reply other threads:[~2013-10-21 15:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 3:26 [PATCH 0/2] i2c-designware-pci: Add Haswell ULT device support Benson Leung
2013-10-21 3:26 ` [PATCH 1/2] i2c-designware-pci: Add Haswell ULT device IDs Benson Leung
2013-10-21 6:53 ` Mika Westerberg
2013-10-21 14:23 ` Benson Leung
2013-10-21 3:26 ` [PATCH 2/2] i2c-designware-pci: Index Haswell ULT bus names from 0 Benson Leung
2013-10-21 6:58 ` Mika Westerberg
2013-10-21 14:20 ` Benson Leung
2013-10-21 16:12 ` Mika Westerberg
2013-11-14 18:05 ` Wolfram Sang
2013-11-20 2:14 ` Benson Leung
2013-11-26 13:09 ` Wolfram Sang
2014-01-03 15:52 ` Wolfram Sang
2014-01-10 0:12 ` Benson Leung
2014-01-10 7:59 ` Jean Delvare
2014-01-16 19:51 ` Wolfram Sang
2014-01-16 20:14 ` Benson Leung
2013-10-21 15:05 ` [PATCH v2 0/2] i2c-designware-pci: Add Haswell ULT device support Benson Leung
2013-10-21 15:05 ` [PATCH v2 1/2] i2c-designware-pci: Add Haswell ULT device IDs Benson Leung
2013-10-21 15:05 ` Benson Leung [this message]
2013-10-21 16:14 ` [PATCH v2 0/2] i2c-designware-pci: Add Haswell ULT device support Mika Westerberg
2014-04-06 13:54 ` Kirill A. Shutemov
2014-04-06 15:31 ` Wolfram Sang
2014-04-07 9:09 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382367944-3005-3-git-send-email-bleung@chromium.org \
--to=bleung@chromium.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dlaurie@chromium.org \
--cc=jacmet@sunsite.dk \
--cc=khali@linux-fr.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).