From patchwork Mon Jun 12 12:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Burri X-Patchwork-Id: 13276416 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 B5DF6C7EE2E for ; Mon, 12 Jun 2023 12:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229946AbjFLMQo (ORCPT ); Mon, 12 Jun 2023 08:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232732AbjFLMQm (ORCPT ); Mon, 12 Jun 2023 08:16:42 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2117.outbound.protection.outlook.com [40.107.21.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30733F4; Mon, 12 Jun 2023 05:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UJyfEk5zjfZdRZZNwQzhTgfAn6dant4v6ul0qqWlIkA4+bUp7Zmtl7BkMIwd3dQR6h6NRYdyZj6KrDEFhlBqQrkMgjDXy3YpFXiBQ61prbHhJUCZb2WL5ZbVUU5Jjsvih69KMY4pRiO/ja6MNT/DSKErL3nrlMh8bdMGuklV2Zsb2BwNrRtyhEWX8BE7zMzImEPpt+b3Igu8E5Fp0oJkLYKzjnH2vZ9+Xwvb+MBi36rYLUMipCxkz7TOme+j9B8TaEe+FKIoBjBBO3g98zkAzEamSdIufDeNJzLK68Y92p+y4GUiZI+SlCTmpPp3G43VCwiwAD0QU8wI+WTiiMpgWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qhy5nzPuN3x/cZUnD+cL3iseeDa2ulwAo2H7jRMJfiE=; b=IUxZqcjyl3M089HrGxqAj7cWLKKw8jMalNa5UD+XViN+vhTZW6q5vIATbW/HDBytker1/MsxcqqsYc/ho7/c8YAg55swgIVsrogA5ps5wRYQaCD0C+5UO/dBED3KUkB9kyN9a5adDfAxpYxkgZUSZwTJFL3+ol6KrlMP7DB3AfhIsWST+Rp7A9LCBPOtYq2Qj/kfc1pOEHbnVKSwmVL4xcq+mlMEZCOjoC6PCwZKWDaRf7mo9BcNt1Nf2ztiNLM95brFiFDPw3PtGVNw2d7CpBTFJ5PNWbE1I2qyz14TZDpbhubqNopoT9P1demhRbNItqiXOX1kpejspGr5GjyrPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mt.com; dmarc=pass action=none header.from=mt.com; dkim=pass header.d=mt.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qhy5nzPuN3x/cZUnD+cL3iseeDa2ulwAo2H7jRMJfiE=; b=oTnI5bX/Lrbd3RuJoiLVaz1gTzG0pyGOEZP/Q8M1nfz+m4GnwFYId92tlbLoe+KnyD5trbSnnhWLrrnrbatRdZdgQF1TNLPhj6UhZ44kpBOhu14eTNTVD4OMSL9e7Y6dkRr87KCBOmXkxMPmAuPFQRrwTY+Ykcd7eBSYxOBAGjEb2yVZ09zq0KeHk0W9PYY9nzSw4YHDCUVpyI1jy6Zhot25MBDzh/NlaxgARfI3cFKXCztnQk1XpcXmaftapdhkClWG55Y3qDdZLcPy6TKNoGI6AgD/eqU/WrhO1l/89sMFByjr7ZZtj5KEo6229KxQ9lOo/tm8Wg3lJCFjblf/Ag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mt.com; Received: from PA4PR03MB7488.eurprd03.prod.outlook.com (2603:10a6:102:bc::11) by DBBPR03MB6922.eurprd03.prod.outlook.com (2603:10a6:10:20e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Mon, 12 Jun 2023 12:16:34 +0000 Received: from PA4PR03MB7488.eurprd03.prod.outlook.com ([fe80::fce6:c9d6:1685:4973]) by PA4PR03MB7488.eurprd03.prod.outlook.com ([fe80::fce6:c9d6:1685:4973%7]) with mapi id 15.20.6455.043; Mon, 12 Jun 2023 12:16:34 +0000 From: Markus Burri To: linux-kernel@vger.kernel.org Cc: Markus Burri , Lars-Peter Clausen , Michael Hennerich , Alexandru Tachici , Jonathan Cameron , linux-iio@vger.kernel.org Subject: [PATCH v1] iio: ado: ad7192: Add error check and more debug log Date: Mon, 12 Jun 2023 14:15:54 +0200 Message-Id: <20230612121554.367285-1-markus.burri@mt.com> X-Mailer: git-send-email 2.39.2 X-ClientProxiedBy: FR2P281CA0077.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9a::14) To PA4PR03MB7488.eurprd03.prod.outlook.com (2603:10a6:102:bc::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4PR03MB7488:EE_|DBBPR03MB6922:EE_ X-MS-Office365-Filtering-Correlation-Id: 6af2ed33-f6f0-4139-bead-08db6b3edce4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L39wHpjE47UMIwhzBkbY5unwbmvX9eHRa8psaUh+iuAyii3ap+0r9gok1bImp/8uttsfo9ZvR3fEqbF+2aihKgEwwkb91w3ghtCmWyCUS04Z6JL7Tpnr0prCWRd9D/Qz/vlxxATlLS3sRy/T587pvtfR+dzx7XhhxEdLABxxhB6hZm3aWZvGfDHoaH/vVE3lJV9neIqGOXfmBsAUhQfFUDST9bqu7VndGRIbgkpfLwrqNe37o/Pf1MKKmv8bxn7LL3Gfz3cuhBktU1BgcV690+LucdyRBPZ+nnz4euaLZTjtvHJQ/ZyJPQps3OglFjnLrOaoKeJjDzDsXCQWrgiUICR7xvYbgEPXyFTaUfbweCLTH0R8lsgC7NihSkP3V0JlC+9TGnZRLYNmq5Dq+8zsuISCINiwQuNg5jUCFR0KnhLD9V69DlTZH/Ro80VL9mNTZVVJ+CXBwl2qgoyxIQrKQDWPFbbwWm6y4Rt/v2uFT/GH3HCrM1gpoqcmEpE9kp1+U58rbbqj8REbRgIOjwJA+vqJFSrbYBBz2RwdhwhzOLjm0BaFDKEiDYUfoGIVHgkDsSM0TT2zvHPCzK1H7lcCVUbKpRmxGnJst6GoO08zrd6z/cp0CEcMPdyc9Rr6ZW2w X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR03MB7488.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(39860400002)(376002)(366004)(346002)(136003)(451199021)(44832011)(4326008)(6916009)(66556008)(66946007)(316002)(66476007)(41300700001)(186003)(2906002)(54906003)(478600001)(8676002)(8936002)(5660300002)(6666004)(52116002)(6486002)(6512007)(1076003)(6506007)(26005)(83380400001)(36756003)(86362001)(2616005)(38100700002)(38350700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hrzI9t40dz1BvGLrQ4kW2v+GhrnVfV3eJua74k5tnRIDkc91TMox897/lMMluZ0ltAU3xA+8drW3VX4Y4lDjmUwPcDBO8Otgeh3EGmMmA7edy/HHTPcKbius5S9g0yfFxh7OnJ/lhh8kf1mMLeiFITR1dYtXtca74I5TsuH5WK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azdmVTnSyCBh0PwIgTD4B5+4/gNbTfTkcYNS6SLxgG/UFjBFN5//jLfkF6Y25lahmG8nyOR+nixfRqi+QdGDtb9dgSfRWPI4Lg/gRGBAYpQFGWZXrEzUHIaBxszqR8JI12I5Q7Muz3fLOr9rM0q7+NZkES8EzjaUMVgzPHj8c0zvH0TfWAGLycFf3zOosMgfll3b+cA/dvdY9mfd0gtYIIi/nYqPVntNALVWEOcFPIg/jJ1VaKHmlXNKCi40we5rQjVDH/MEKPT7LTJYXuHFQy9rYhYjSlw+CGfazYMRimv+/BmmocYisLmxZGQX8zVxPymI9HFsfs5aZG9FZvx8CaZfy2rV X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6af2ed33-f6f0-4139-bead-08db6b3edce4 X-MS-Exchange-CrossTenant-AuthSource: PA4PR03MB7488.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 12:16:34.3006 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fb4c0aee-6cd2-482f-a1a5-717e7c02496b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1PYEJLC/IYCJo2melmuuH4yRvCZKL02rXzSoHllW6R6GT+cW2evT7IqdPbXt/0nax/lXPyvvwYnMkYYSE5DpYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR03MB6922 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Print read and expected device ID as debug warning. Add error check for sd_sd_init() result. Signed-off-by: Markus Burri --- drivers/iio/adc/ad7192.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index d71977b..220c3b7 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -403,8 +403,8 @@ static int ad7192_setup(struct ad7192_state *st, struct device_node *np) id &= AD7192_ID_MASK; if (id != st->chip_info->chip_id) - dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n", - id); + dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X != 0x%X)\n", + id, st->chip_info->chip_id); st->mode = AD7192_MODE_SEL(AD7192_MODE_IDLE) | AD7192_MODE_CLKSRC(st->clock_sel) | @@ -1049,7 +1049,9 @@ static int ad7192_probe(struct spi_device *spi) else indio_dev->info = &ad7192_info; - ad_sd_init(&st->sd, indio_dev, spi, &ad7192_sigma_delta_info); + ret = ad_sd_init(&st->sd, indio_dev, spi, &ad7192_sigma_delta_info); + if (ret) + return ret; ret = devm_ad_sd_setup_buffer_and_trigger(&spi->dev, indio_dev); if (ret)