Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2513754imm; Mon, 24 Sep 2018 05:44:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV61zgiOhizHL/Ivg+DN6vy66TwNFld691MBtUEazztYPwn9tad8JkKRBLL9BFzVuyQ2hr87A X-Received: by 2002:a63:b95e:: with SMTP id v30-v6mr9226433pgo.221.1537793098135; Mon, 24 Sep 2018 05:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793098; cv=none; d=google.com; s=arc-20160816; b=X/bikJhsEOSuZtm3ZRjRdnh6uLnCOA7T1+eIpgGkWOyimjiPYUZEj9UB+yOAYIyvHp hsbjpWdjyNa+v8VULJ7nM6tTx06PscTbC/h2eocNr5LPdqjy0v6sd+EcSvPZpwXw1BOr my3pwZIH0sP2epPXHlXzvPCD1wQ49y/H83uiMWkoYHld3SUeImBb0veCfXjmhD5Vuz3z yeGG8fSJslJ79mN6kIb64/Gi9+C+zxDVaP+sgcqK+UdkXYcuAPuesyjdSU9lw7TLMbma aGz9f8E1BHt8y3JW/UFYn4CNCUvicLVUXJTbUTPLTkAVXGgaQm0vv3c8tAwvwMnkK82T Q9xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=jbGb9rLTZHHib6PDhtu08cFOm9TshjDysjeqPgkPFRc=; b=e0M8bCIPM8y6w1ub9k9LyMIYI+up3LOhogKfsl0sie4Xh1Uw+HyY/+4rndkAvRZe9Y E989m2sA++TOz2oi3eGJJ7ruXGA2pyM6u0DfWapFKyEyxdfQoI4RkQQYDZdXD35OjDJB 3CGB18HP+aFKrhjTBts3HCqCgeOoH0M7fVn347RUOyMV8b6rak6GVdoRUomlk4PiKLjc IO44ykjgfFhEkIvBScBj1Oilbuy01rxK/Bv5FlaOW9nqSvyRHlfKykBU3VMQPaxcEYn+ WRnlwZMOgl5rxx+LxZ1Gp8/xP7Fj2b+3MT70Xh8qboqiFUoDO5mnMq62opzPF/bwzssg r6Ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5-v6si1140192pgm.268.2018.09.24.05.44.42; Mon, 24 Sep 2018 05:44:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389079AbeIXSpp (ORCPT + 99 others); Mon, 24 Sep 2018 14:45:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59506 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388731AbeIXSpo (ORCPT ); Mon, 24 Sep 2018 14:45:44 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5D00D1099; Mon, 24 Sep 2018 12:43:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Rosin , Lee Jones , Wolfram Sang , Sasha Levin Subject: [PATCH 4.18 205/235] mfd: 88pm860x-i2c: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT) Date: Mon, 24 Sep 2018 13:53:11 +0200 Message-Id: <20180924113124.533031471@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Rosin [ Upstream commit 8c8f74f327a76604a499fad8c54c15e1c0ee8051 ] Locking the root adapter for __i2c_transfer will deadlock if the device sits behind a mux-locked I2C mux. Switch to the finer-grained i2c_lock_bus with the I2C_LOCK_SEGMENT flag. If the device does not sit behind a mux-locked mux, the two locking variants are equivalent. Signed-off-by: Peter Rosin Acked-by: Lee Jones Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/mfd/88pm860x-i2c.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/mfd/88pm860x-i2c.c +++ b/drivers/mfd/88pm860x-i2c.c @@ -146,14 +146,14 @@ int pm860x_page_reg_write(struct i2c_cli unsigned char zero; int ret; - i2c_lock_adapter(i2c->adapter); + i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT); read_device(i2c, 0xFA, 0, &zero); read_device(i2c, 0xFB, 0, &zero); read_device(i2c, 0xFF, 0, &zero); ret = write_device(i2c, reg, 1, &data); read_device(i2c, 0xFE, 0, &zero); read_device(i2c, 0xFC, 0, &zero); - i2c_unlock_adapter(i2c->adapter); + i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT); return ret; } EXPORT_SYMBOL(pm860x_page_reg_write); @@ -164,14 +164,14 @@ int pm860x_page_bulk_read(struct i2c_cli unsigned char zero = 0; int ret; - i2c_lock_adapter(i2c->adapter); + i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT); read_device(i2c, 0xfa, 0, &zero); read_device(i2c, 0xfb, 0, &zero); read_device(i2c, 0xff, 0, &zero); ret = read_device(i2c, reg, count, buf); read_device(i2c, 0xFE, 0, &zero); read_device(i2c, 0xFC, 0, &zero); - i2c_unlock_adapter(i2c->adapter); + i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT); return ret; } EXPORT_SYMBOL(pm860x_page_bulk_read);