Linux Power Management development
 help / color / mirror / Atom feed
From: "Alex A. Mihaylov" <minimumlaw@rambler.ru>
To: Mark Brown <broonie@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sebastian Reichel <sre@kernel.org>,
	Evgeniy Polyakov <zbr@ioremap.net>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Cc: "Alex A. Mihaylov" <minimumlaw@rambler.ru>
Subject: [PATCH 4/4] Fix W1 slave exchange with second device on probe step
Date: Thu, 25 May 2017 20:47:21 +0300	[thread overview]
Message-ID: <20170525174721.3245-5-minimumlaw@rambler.ru> (raw)
In-Reply-To: <20170525174639.3191-1-minimumlaw@rambler.ru>

Signed-off-by: Alex A. Mihaylov <minimumlaw@rambler.ru>
---
 drivers/w1/w1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 90a3d93..5b8b976 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -731,6 +731,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
 	memcpy(&sl->reg_num, rn, sizeof(sl->reg_num));
 	atomic_set(&sl->refcnt, 1);
 	atomic_inc(&sl->master->refcnt);
+	dev->slave_count++;
 
 	/* slave modules need to be loaded in a context with unlocked mutex */
 	mutex_unlock(&dev->mutex);
@@ -750,11 +751,11 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
 
 	sl->family = f;
 
-
 	err = __w1_attach_slave_device(sl);
 	if (err < 0) {
 		dev_err(&dev->dev, "%s: Attaching %s failed.\n", __func__,
 			 sl->name);
+		dev->slave_count--;
 		w1_family_put(sl->family);
 		atomic_dec(&sl->master->refcnt);
 		kfree(sl);
@@ -762,7 +763,6 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
 	}
 
 	sl->ttl = dev->slave_ttl;
-	dev->slave_count++;
 
 	memcpy(msg.id.id, rn, sizeof(msg.id));
 	msg.type = W1_SLAVE_ADD;
-- 
2.8.4 (Apple Git-73)

      parent reply	other threads:[~2017-05-25 17:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 17:46 [PATCH 0/4] Maxim Semiconductor MAX1721x power_supply driver Alex A. Mihaylov
2017-05-25 17:46 ` [PATCH 1/4] Introduce regmap infrastructure over Maxim/Dalas OneWire (W1) bus Alex A. Mihaylov
2017-05-25 18:51   ` Greg Kroah-Hartman
2017-05-26  9:56     ` Mark Brown
2017-05-26 10:21   ` Mark Brown
2017-05-26 15:50     ` Alex A. Mihaylov
     [not found]   ` <404871495743279@web24o.yandex.ru>
2017-05-26 11:06     ` Mark Brown
     [not found]       ` <3411811495806312@web49j.yandex.ru>
2017-05-26 16:17         ` Alex A. Mihaylov
2017-05-26 17:18         ` Mark Brown
     [not found]           ` <4265821495830391@web12o.yandex.ru>
2017-06-28 19:37             ` Mark Brown
     [not found]               ` <939401499441188@web18j.yandex.ru>
2017-07-07 17:11                 ` Mark Brown
2017-05-25 17:46 ` [PATCH 2/4] Introduce new OneWire (W1) family 0x26 with slave device Maxim Semconductor MAX17211/MAX17215 Fuel Gauge IC Alex A. Mihaylov
2017-05-25 17:46 ` [PATCH 3/4] Introduce Maxim Semiconductor MAX17211/MAX17215 Standalone Fuel Gauge IC support for power_supply class driver Alex A. Mihaylov
2017-05-25 17:47 ` Alex A. Mihaylov [this message]

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=20170525174721.3245-5-minimumlaw@rambler.ru \
    --to=minimumlaw@rambler.ru \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    --cc=zbr@ioremap.net \
    /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