From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 043F1C433E7 for ; Sun, 18 Oct 2020 14:43:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B72FB21D7F for ; Sun, 18 Oct 2020 14:43:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=beagleboard-org.20150623.gappssmtp.com header.i=@beagleboard-org.20150623.gappssmtp.com header.b="1pvu8Cf1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726886AbgJROnr (ORCPT ); Sun, 18 Oct 2020 10:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726519AbgJROnp (ORCPT ); Sun, 18 Oct 2020 10:43:45 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0CAAC061755 for ; Sun, 18 Oct 2020 07:43:45 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id hk7so4129996pjb.2 for ; Sun, 18 Oct 2020 07:43:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beagleboard-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=ioUl3a2YgheFEBSCpVRh2eFlj1emUIf0N1aypWiTiuE=; b=1pvu8Cf19+kAXYtldE/dTmygylRaMkNNM8nwYYEwlimC8KCif2WRiBRlNaFGyTlaEl sVFDna9EN67/aspy2sP+A6GrIpD0U33kwbYpVTmsvK9MJJRjf4Rpz3xbGzhbjHapNPqZ PNw1HoabNIG7L1H/AkhC3xSVwTs+kb5pB1vz07IdbXTL6CPPAMoT5axmtvwzI5Xo8MxK 0MIouvMgixoy+29kFYYmf47nqt/tCjDf669FNNfGcX7NBVd8CQeIaipKs8rqOK12f4QR 7TlEWLm7EsCx/8JyI1Xbvq1IH/iEIEKZIZopqeoKtbrOnzxoSqnDzXuQkMgzkN3YxG3L sLRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=ioUl3a2YgheFEBSCpVRh2eFlj1emUIf0N1aypWiTiuE=; b=DGJjk1G8+elsHexJft9m0WmD+hj+/+8Cs1OZOtF46vxsU1L2Pv/ha9PpFiR4rxu0lP DSXYKghXwSvN+Z2b+dyPxGPx9VrjVU5NOvijBeS707/Ck3/AAXIHKMr9g9txWPpS0mWg RpFYKTEzKkVg8ik+RAL9NXIeFjbL3O3QqldOfdO+8jas68GWx6YfhE1lSPVGdvx2uqZR ToZSPyE7350RliMZIpKz9lNKoBJeR2tsZxZva7+VgZjGyfJ2huWmbHmPNJK50HjYaNfW OqX+4ObROllEvXxe1lSav9g7K/OY5GWjADCKLmtDrCSQpv7Ihdi7L5RqkhbRlgjxQ2n7 15Rw== X-Gm-Message-State: AOAM532aP4XIO3fzPbqz5RhTOxoRX252yhHh4flzSP5HE3aGQl8DKQco /noDX/X69g1QVk+G49TAA3s5 X-Google-Smtp-Source: ABdhPJwDBZ8z9w+JO0X8KwfUGLubtnNMj3YJONCELYeIaSreLj+jt/9KPtKGB0f7aDikUf15snO2LQ== X-Received: by 2002:a17:902:ed54:b029:d3:d0bc:e41d with SMTP id y20-20020a170902ed54b02900d3d0bce41dmr13769272plb.13.1603032225390; Sun, 18 Oct 2020 07:43:45 -0700 (PDT) Received: from ubuntu ([116.68.78.80]) by smtp.gmail.com with ESMTPSA id f1sm8600675pfe.145.2020.10.18.07.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Oct 2020 07:43:44 -0700 (PDT) Date: Sun, 18 Oct 2020 20:13:38 +0530 From: Vaishnav M A To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, nish.malpani25@gmail.com, alexandru.ardelean@analog.com, matt.ranostay@konsulko.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jkridner@beagleboard.org, drew@beagleboard.org, robertcnelson@beagleboard.org, rajkovic@mikroe.com, vaishnav@beagleboard.org Subject: [PATCH v3] iio: light: tsl2563 change of_property_read to device_property_read Message-ID: <20201018144338.GA218707@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace of_property_read_u32() with device_property_read_u32, when reading the amstaos,cover-comp-gain.This opens up the possibility of passing the properties during platform instantiation of the device by a suitable populated struct property_entry. Additionally a minor change to logic is added to remove the of_node present check. Signed-off-by: Vaishnav M A --- v3: -modify commit message for readability, mention minor logic change -include mod_devicetable.h and property.h headers v2: -fix commit message drivers/iio/light/tsl2563.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c index abc8d7db8dc1..5bf2bfbc5379 100644 --- a/drivers/iio/light/tsl2563.c +++ b/drivers/iio/light/tsl2563.c @@ -12,6 +12,8 @@ */ #include +#include +#include #include #include #include @@ -703,7 +705,6 @@ static int tsl2563_probe(struct i2c_client *client, struct iio_dev *indio_dev; struct tsl2563_chip *chip; struct tsl2563_platform_data *pdata = client->dev.platform_data; - struct device_node *np = client->dev.of_node; int err = 0; u8 id = 0; @@ -738,13 +739,14 @@ static int tsl2563_probe(struct i2c_client *client, chip->calib0 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS); chip->calib1 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS); - if (pdata) + if (pdata) { chip->cover_comp_gain = pdata->cover_comp_gain; - else if (np) - of_property_read_u32(np, "amstaos,cover-comp-gain", - &chip->cover_comp_gain); - else - chip->cover_comp_gain = 1; + } else { + err = device_property_read_u32(&client->dev, "amstaos,cover-comp-gain", + &chip->cover_comp_gain); + if (err) + chip->cover_comp_gain = 1; + } dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f); indio_dev->name = client->name; -- 2.25.1