From patchwork Thu Dec 7 11:25:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 845530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ystT92V50z9sNc for ; Thu, 7 Dec 2017 22:25:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752869AbdLGLZs (ORCPT ); Thu, 7 Dec 2017 06:25:48 -0500 Received: from mx2.suse.de ([195.135.220.15]:52365 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752491AbdLGLZs (ORCPT ); Thu, 7 Dec 2017 06:25:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 27E35AC6E; Thu, 7 Dec 2017 11:25:47 +0000 (UTC) Date: Thu, 7 Dec 2017 12:25:45 +0100 From: Jean Delvare To: Linux I2C Cc: Guenter Roeck , Wolfram Sang Subject: [PATCH] i2c: piix4: Fix port number check on release Message-ID: <20171207122545.1b8e17c6@endymion> Organization: SUSE Linux X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The port number shift is still hard-coded to 1 while it now depends on the hardware. Thankfully 0 is always 0 no matter how you shift it, so this was a bug without consequences. Signed-off-by: Jean Delvare Fixes: 0fe16195f891 ("i2c: piix4: Fix SMBus port selection for AMD Family 17h chips") Cc: Guenter Roeck Cc: Wolfram Sang Reviewed-by: Guenter Roeck --- Sorry for missing this while reviewing the original patch. drivers/i2c/busses/i2c-piix4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- linux-4.14.orig/drivers/i2c/busses/i2c-piix4.c 2017-12-07 11:06:05.198260340 +0100 +++ linux-4.14/drivers/i2c/busses/i2c-piix4.c 2017-12-07 12:18:56.405907856 +0100 @@ -989,7 +989,7 @@ static void piix4_adap_remove(struct i2c if (adapdata->smba) { i2c_del_adapter(adap); - if (adapdata->port == (0 << 1)) { + if (adapdata->port == (0 << piix4_port_shift_sb800)) { release_region(adapdata->smba, SMBIOSIZE); if (adapdata->sb800_main) release_region(SB800_PIIX4_SMB_IDX, 2);