From: Christian Fetzer <fetzer.ch@gmail.com>
To: linux-i2c@vger.kernel.org
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Wolfram Sang <wsa@the-dreams.de>,
galandilias@gmail.com, Christian Fetzer <fetzer.ch@gmail.com>
Subject: [PATCH v3 1/5] i2c-piix4: Optionally release smba in piix4_adap_remove
Date: Sat, 7 Nov 2015 12:35:22 +0100 [thread overview]
Message-ID: <1446896126-13369-2-git-send-email-fetzer.ch@gmail.com> (raw)
In-Reply-To: <1446896126-13369-1-git-send-email-fetzer.ch@gmail.com>
This is in preparation to support the multiplexed SMBus main controller
in the SB800 chipset where the controller address is shared among
the four multiplexed ports. As such the address region should be
only freed for the first multiplexed adapter to avoid double free
warnings.
Signed-off-by: Christian Fetzer <fetzer.ch@gmail.com>
---
drivers/i2c/busses/i2c-piix4.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 630bce6..e78b982 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -660,13 +660,14 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
return 0;
}
-static void piix4_adap_remove(struct i2c_adapter *adap)
+static void piix4_adap_remove(struct i2c_adapter *adap, bool free_smba)
{
struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap);
if (adapdata->smba) {
i2c_del_adapter(adap);
- release_region(adapdata->smba, SMBIOSIZE);
+ if (free_smba)
+ release_region(adapdata->smba, SMBIOSIZE);
kfree(adapdata);
kfree(adap);
}
@@ -675,12 +676,12 @@ static void piix4_adap_remove(struct i2c_adapter *adap)
static void piix4_remove(struct pci_dev *dev)
{
if (piix4_main_adapter) {
- piix4_adap_remove(piix4_main_adapter);
+ piix4_adap_remove(piix4_main_adapter, true);
piix4_main_adapter = NULL;
}
if (piix4_aux_adapter) {
- piix4_adap_remove(piix4_aux_adapter);
+ piix4_adap_remove(piix4_aux_adapter, true);
piix4_aux_adapter = NULL;
}
}
--
1.9.1
next prev parent reply other threads:[~2015-11-07 11:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-07 11:35 [PATCH v3 0/5] Support multiplexed main SMBus interface on SB800 Christian Fetzer
2015-11-07 11:35 ` Christian Fetzer [this message]
2015-11-09 11:24 ` [PATCH v3 1/5] i2c-piix4: Optionally release smba in piix4_adap_remove Mika Westerberg
2015-11-07 11:35 ` [PATCH v3 2/5] i2c-piix4: Convert piix4_main_adapter to array Christian Fetzer
2015-11-07 11:35 ` [PATCH v3 3/5] i2c-piix4: Request base address index region once for SB800 Christian Fetzer
2015-11-09 10:40 ` Andy Shevchenko
2015-11-07 11:35 ` [PATCH v3 4/5] i2c-piix4: Add support for multiplexed main adapter in SB800 Christian Fetzer
2015-11-09 10:45 ` Andy Shevchenko
2016-01-22 12:39 ` Jean Delvare
2016-01-22 13:20 ` Andy Shevchenko
2015-11-07 11:35 ` [PATCH v3 5/5] i2c-piix4: Add adapter port name support for SB800 chipset Christian Fetzer
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=1446896126-13369-2-git-send-email-fetzer.ch@gmail.com \
--to=fetzer.ch@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=galandilias@gmail.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-i2c@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).