linux-aspeed.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH v12 2/2] i2c: aspeed: support ast2600 i2c new register mode driver
Date: Fri, 14 Jul 2023 10:57:57 +0200	[thread overview]
Message-ID: <674fed6f-36d6-bacb-d075-97bc355177a3@linaro.org> (raw)
In-Reply-To: <SEZPR06MB5269EB586319B3333CD96010F234A@SEZPR06MB5269.apcprd06.prod.outlook.com>

On 14/07/2023 10:08, Ryan Chen wrote:
> Hello,
> 
> On 14/07/2023 09:45, Ryan Chen wrote:
>> Add i2c new register mode driver to support AST2600 i2c new register 
>> mode. AST2600 i2c controller have legacy and new register mode. The 
>> new register mode have global register support 4 base clock for scl 
>> clock selection, and new clock divider mode. The i2c new register mode 
>> have separate register set to control i2c master and slave.
>>
>> Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
>> ---
> 
> ...
> 
>> +	ret = devm_i2c_add_adapter(dev, &i2c_bus->adap);
>> +	if (ret)
>> +		return ret;
>> +
>> +	return 0;
>> +}
>> +
>> +static int ast2600_i2c_remove(struct platform_device *pdev) {
>> +	struct ast2600_i2c_bus *i2c_bus = platform_get_drvdata(pdev);
>> +
>> +	/* Disable everything. */
>> +	writel(0, i2c_bus->reg_base + AST2600_I2CC_FUN_CTRL);
>> +	writel(0, i2c_bus->reg_base + AST2600_I2CM_IER);
>> +
>> +	i2c_del_adapter(&i2c_bus->adap);
> 
>> I have doubts that you tested this. I think you have here double free/del of the adapter.
> Sorry, i can't catch your point for double free the adapter.
> It should use i2c_del_adapter in driver remove function.
> All the driver doing this 
> https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-npcm7xx.c#L2373
> https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-altera.c#L473
> 
> Do you mean it is not necessary? 

Instead of giving you the fish, I think much more learning experience is
to teach you how to fish. Please unbind your driver (echo the device
name to proper unbind file in sysfs). The best if you build your kernel
with KASAN.

Best regards,
Krzysztof


  parent reply	other threads:[~2023-07-14  8:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14  7:45 [PATCH v12 0/2] Add ASPEED AST2600 I2Cv2 controller driver Ryan Chen
2023-07-14  7:45 ` [PATCH v12 1/2] dt-bindings: i2c: aspeed: support for AST2600-i2cv2 Ryan Chen
2023-07-14  7:45 ` [PATCH v12 2/2] i2c: aspeed: support ast2600 i2c new register mode driver Ryan Chen
2023-07-14  8:03   ` Krzysztof Kozlowski
2023-07-14  8:08     ` Ryan Chen
2023-07-14  8:56       ` Andy Shevchenko
2023-07-14  8:57       ` Krzysztof Kozlowski [this message]
2023-07-14  9:26         ` Ryan Chen
2023-07-26  3:38           ` Ryan Chen
2023-07-26  6:31             ` Krzysztof Kozlowski
2023-07-26  6:19           ` Ryan Chen
2023-07-14  8:55   ` Andy Shevchenko
2023-08-31  6:04     ` Ryan Chen
2023-08-31 14:18       ` Andy Shevchenko
2023-09-05  6:52     ` Ryan Chen
2023-09-05 11:55       ` Andy Shevchenko
2023-10-05  6:21         ` Ryan Chen
2023-10-05 11:56           ` Andy Shevchenko
2023-10-11  7:36             ` Ryan Chen
2023-10-11  8:17               ` Ryan Chen

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=674fed6f-36d6-bacb-d075-97bc355177a3@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    /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).