From patchwork Sun Feb 19 16:58:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angel Iglesias X-Patchwork-Id: 59189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp931159wrn; Sun, 19 Feb 2023 09:05:08 -0800 (PST) X-Google-Smtp-Source: AK7set9nzbYMIFu6+j8CRZGYyEkpkDW2asFoBY7kmQoELsdrh2rY53QDb4qLuM+QHj1T1FaCr7+v X-Received: by 2002:a05:6a00:a0a:b0:5a8:b6ec:3aac with SMTP id p10-20020a056a000a0a00b005a8b6ec3aacmr1652896pfh.15.1676826307824; Sun, 19 Feb 2023 09:05:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676826307; cv=none; d=google.com; s=arc-20160816; b=VSNnkCSyMHRI+/76T1OmDcBFiiDlsbXGHoCexWhkhopp+03fzOisKR7xy9zi5+AwMC 3AGE28G8i6EzDFLcgKvrmHAHPz2XyNSAcpbvdotxbJrVYBsHZzq7oErmcBOi8Jc/GXrG LXQ/JG4DSWDeIv/SqKqc0US7GSI8D3MoLf1pRGFkNx5SRJiVUqAe0iJisu9HaPkz9z9A rw9IXI6X4k09l4GQ8ZrfcaKlAchEc8aop1HxDVBPgIv/AC+DFQ9S8U9zpEWoYzuEaxVr C2SSjkeLWDL6r1OttyjfE1OXkQalZvYle21gqlaC1rN8tW9Uvi7oi5UAGwQ3WOt1gT9s ShEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+jMw2kTtplEGyBtKDhcA5Kzq78Ybi6Nx/sQrMjtKIlU=; b=Um4EkdeXDfI3JA3uarpj/EicD/+QKHm+Hig+zjPt/7ntzLFkwBRdjz7lT3XDlDlsSL kkBsma2t3HkZh2Dr59PQ/a9c1+iQWSSffEKALk3hNkw3TTGpejk4k5+22L4CAtkMkH/1 /QDxVy7su0+9fRInizmJi2QedWrsyTKankntdJdeBnaE5UeiWou/ZMDodgVUW4GIz+hK 4oAbyVjwZFnPcZm7LEkAVLzDI2RteWtFOZgxU18OgeLwtJIVrN4YAbMtX9C8+Yv7Hqip 8zvtUcATTUjdZkaBPR3dBfbeCXQrnC+w6v6yo+vEfrf3TPfr/hAUwSqJSL5ju7un3fsA TPxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XmVWcgvY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020aa79795000000b00593adf103c0si10732163pfp.60.2023.02.19.09.04.52; Sun, 19 Feb 2023 09:05:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XmVWcgvY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230428AbjBSRA4 (ORCPT + 99 others); Sun, 19 Feb 2023 12:00:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjBSRAy (ORCPT ); Sun, 19 Feb 2023 12:00:54 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A84F126F4; Sun, 19 Feb 2023 09:00:40 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id s17so628562wrt.8; Sun, 19 Feb 2023 09:00:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+jMw2kTtplEGyBtKDhcA5Kzq78Ybi6Nx/sQrMjtKIlU=; b=XmVWcgvYAfDGPjve2bb4IYdsfYdOY7mDhgmyT/eIF4RAHmCVIGiZPKlLk9BBmM7Fy5 nimy6G3AaTXskYuYSrJP3wrYybzgVfLvEvgHwXTpggYSs9bkEG5ACSIsLVnJK0nYik6N v+uk7f68DqJehKfhXsjWqS3n28wwWOx+FNW6t9UVvGgm4WpRbw1EIaWLW7S8WkNxyOIM JH8DIfbEL250YDMN1SFzA/007CzCRVWBxFK998Or4pOxBcMnaWZLmI9L0agltSGl7xa3 aUvGxwb7cPZZ7GlwxK68blLlGkw7LWm2xdskdQUVPDkNmjoKDiIxttP9/2djv/Zypips Rwdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+jMw2kTtplEGyBtKDhcA5Kzq78Ybi6Nx/sQrMjtKIlU=; b=T1xPf05qWuDspAVHKccv6TeGrcRoGTL3JOpitC2cL61Vg4iDjaEebf9H0D7cYWk0AR 0RTTa9PR1F1uDJL/igPaM4X1B67F4XRblZgiONljy/djNhQ3uZ6xfuQ7Z3UweA6Ntm3H HvnHkdg21DgAlGPLsNz0P2kJJ+lcEorqmaOSEjNk97TtoMCrCpruFHnQTnZaD6hj4Syz sffFal02E7TL5el3QedA6INpdBGy/cGj+h2zvhP/um9J6d6PW6Uf31+IFtBwJPjX2r0c lfwgXyzqlTLQNmp5CsUjCngn72oSHEMoRiWOvfklQs126x/3g0LWQ/jUSZeawJzmiZd4 tKkw== X-Gm-Message-State: AO0yUKVfORy0xk4NoC4kGwznACxZ+0Rn9BHYAZwCL7X3aZIlzjeAX7I/ D545z6ehjuOZEW+6wW9Gyi2LdnX78GY= X-Received: by 2002:a05:6000:8a:b0:2c5:5886:8505 with SMTP id m10-20020a056000008a00b002c558868505mr2657884wrx.53.1676826038843; Sun, 19 Feb 2023 09:00:38 -0800 (PST) Received: from localhost.localdomain (6.red-83-37-22.dynamicip.rima-tde.net. [83.37.22.6]) by smtp.gmail.com with ESMTPSA id v20-20020a5d5914000000b002c552c6c8c2sm366427wrd.87.2023.02.19.09.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 09:00:38 -0800 (PST) From: Angel Iglesias To: linux-iio@vger.kernel.org Cc: Angel Iglesias , Jonathan Cameron , Andy Shevchenko , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Alexandru Lazar , Andreas Klinger , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/7] iio: pressure: bmp280: Make read calibration callback optional Date: Sun, 19 Feb 2023 17:58:01 +0100 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758279822820829323?= X-GMAIL-MSGID: =?utf-8?q?1758279822820829323?= Newer models do not require read the calibration parameters and apply the compensation algorithms in the sensor. Suggested-by: Jonathan Cameron Signed-off-by: Angel Iglesias Reviewed-by: Andy Shevchenko diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c index 6467034b1d3e..22addaaa5393 100644 --- a/drivers/iio/pressure/bmp280-core.c +++ b/drivers/iio/pressure/bmp280-core.c @@ -1631,10 +1631,12 @@ int bmp280_common_probe(struct device *dev, * time once. They will not change. */ - ret = data->chip_info->read_calib(data); - if (ret < 0) - return dev_err_probe(data->dev, ret, - "failed to read calibration coefficients\n"); + if (data->chip_info->read_calib) { + ret = data->chip_info->read_calib(data); + if (ret < 0) + return dev_err_probe(data->dev, ret, + "failed to read calibration coefficients\n"); + } /* * Attempt to grab an optional EOC IRQ - only the BMP085 has this