From patchwork Sun Feb 6 19:03:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12736648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 002ABC433EF for ; Sun, 6 Feb 2022 18:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229883AbiBFS5Q (ORCPT ); Sun, 6 Feb 2022 13:57:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233900AbiBFS5P (ORCPT ); Sun, 6 Feb 2022 13:57:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56955C043184 for ; Sun, 6 Feb 2022 10:57:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E5AB261227 for ; Sun, 6 Feb 2022 18:57:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53F31C340EF; Sun, 6 Feb 2022 18:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644173834; bh=vgSWeYVc4DC4rLXfqIwIgrjRBcHsKUTOcLqdSvqtB8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ha5J01lZHr65WdbI7oMFAoOPFgQKAGv/woQMcfwAY3kQyMnySLDBhrAoMc3jv2q7j 9bj2mYQsLIOAnp2kPo8ebB8dNFoIbmAJOxKbunfWe22k4HzOM+aKz4HYgW2Fr+47gO KuI1z9fFXK56zEQa7kwMbCMl3+2Dc1tEVZyH1oNjjZYwB/ZPmwMq0NXfT65OlI8FhB SfBpbvlevp+CMWvDJMd9yuzc3yH0CzCwWoGb+tvuIAl3fYrotfWXHt+uGqSxlvq4Jq 4TOlOBTPaMtnVT0NQx648iI8EfOIfBVd2QFaojLdrRaNVMmW2CjsSV2/EVvjYuR/I4 tFIeEswjeiHrw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Marcelo Schmitt Cc: Hennerich@vger.kernel.org, Michael , Nuno Sa , lars@metafoo.de, Jonathan Cameron Subject: [PATCH v3 01/20] staging:iio:adc:ad7280a: Fix handing of device address bit reversing. Date: Sun, 6 Feb 2022 19:03:09 +0000 Message-Id: <20220206190328.333093-2-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220206190328.333093-1-jic23@kernel.org> References: <20220206190328.333093-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron The bit reversal was wrong for bits 1 and 3 of the 5 bits. Result is driver failure to probe if you have more than 2 daisy-chained devices. Discovered via QEMU based device emulation. Fixes tag is for when this moved from a macro to a function, but it was broken before that. Signed-off-by: Jonathan Cameron Fixes: 065a7c0b1fec ("Staging: iio: adc: ad7280a.c: Fixed Macro argument reuse") Reviewed-by: Marcelo Schmitt --- drivers/staging/iio/adc/ad7280a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index fef0055b8990..20183b2ea127 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -107,9 +107,9 @@ static unsigned int ad7280a_devaddr(unsigned int addr) { return ((addr & 0x1) << 4) | - ((addr & 0x2) << 3) | + ((addr & 0x2) << 2) | (addr & 0x4) | - ((addr & 0x8) >> 3) | + ((addr & 0x8) >> 2) | ((addr & 0x10) >> 4); }