Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1952288pxu; Sun, 13 Dec 2020 08:36:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzadsuVDbv2e+o14X0c6F9FMLk+OEa2px2N9GSu25Kkd04Yg0VevyNjOa6ts5/0BnsB9ACT X-Received: by 2002:a05:6402:14c5:: with SMTP id f5mr20527440edx.232.1607877411982; Sun, 13 Dec 2020 08:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607877411; cv=none; d=google.com; s=arc-20160816; b=yTUyuEPBI6X4jAQpuR/71uxuc3ylmVra61EmaNX92qwQhAKJ+QD7JavZpIMDRa9ddk zGGh7vrIlV98sL8WDY2gHaJ/HdF27njems5dkpFXk8e2/vKFXCst1tLzAxkixq5Vu8jY kZUd5nXhB0++pcEZwz79lCE8bNqn61zJEvIcwNCk4DNv6p7sPsDpJnPTgjJZ42+yc/Lz q6b58Rv9TBDNIuSLcbp4Zlm5T2tYiogjRAzspDIiNs0l5QpAx0kYgm3fDtzCMHnStUlp 4HeoJPmIX78ftLBtfcR/+xd/V42SQqziBbVTAKKcoh8KFszeL1NYaUMG5FaDZI9Wev/k 9MlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=priY+gMifRi9SXBuHcjr1reGmyMklvNrzc4Nr2fnS9Q=; b=Ej9FVXC23Tivqn90byCecjAW9cZEOjib9ueVVW+ieJoXM1l71DtnCDkaUdDP3kvqGD C3kFfBEb+UR3axUMRJCfrTSPzDalX0SJg8/aafNMFSp3Xd93s01FXHj5IUZogPqhCgD5 wG482JnMAd/zomyl3LSdekYf2lybr9nZAQw1YnbnASbbrn+JBoE7zYsx8cUJA3ZIxZD4 MFNwrUSRo8pdZohtG7guVJ18ttTQ/eYoB6rHnaq23G6PsVA5gaVBgA7Xbbmwu5nBE3WX aesqr9f0j5Na5BMebNbUHpiqsFvi4BHCsk9+j3/2KOhnBh9a99RMdz/XUGwWC+Z/psBC LUnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VZKP0fs8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id md16si7930583ejb.563.2020.12.13.08.36.29; Sun, 13 Dec 2020 08:36:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VZKP0fs8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2439761AbgLLS1N (ORCPT + 99 others); Sat, 12 Dec 2020 13:27:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436509AbgLLS1N (ORCPT ); Sat, 12 Dec 2020 13:27:13 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEEF6C0613CF; Sat, 12 Dec 2020 10:26:32 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id j1so6424382pld.3; Sat, 12 Dec 2020 10:26:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=priY+gMifRi9SXBuHcjr1reGmyMklvNrzc4Nr2fnS9Q=; b=VZKP0fs8LF7hQa1pTcSvuxBeTtWQF+gDl/Bn3za06fUJMryGc/RyjZXn5qdUbxqU7+ ttugcx06d2j0fndpQ3+adqR/4jniLSdLxc5im7DKfvTgDTVwrq0L0rO4ATdk+DfgQYvP FccsHypPr5/fRftFBTaTDTgPVh9c+DYa54hstdtJZKgavUCudoS60Ug84TKng6PqFqRW wBczxNkNN5ZT8cY0RwTdGG8ztaxx7xmS4ZZaP+5Y+JyhYwJy6QF3orO2TQljaYdxBj/F X1KnsfashpFgKkKrqfo7Qa+XbEKIjHUcmn9LlY2Tzta0T7z8pTD8SPlpNwIQ9ZW9snQr DUsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=priY+gMifRi9SXBuHcjr1reGmyMklvNrzc4Nr2fnS9Q=; b=R/vxuAqvrshPvwdxlGx8O3iZyv+qUGtoPeCOjBXEtfsKAEikhDxBDf688wVeQcf0Cd xZfug5ISw3HohV0OriMRHPsvgppUdmzlpau+Tj6P3bV724JILa9R+6MvKok6n1ztK1Ug e2GkoqT5Qa6nUvJL9Kpr08w4yYlGhdwWh781IQRuvK4KuKF0M8/9odTzTWvbiVGvylGh o78GI8hmVZpWg5zca7DsI6lnNW8ZsuvbUpvfNti01C9NSI13JriPGGcO7nrdZtFRlFCM fvBqMBeG7EdoDEZLl3UHJujabfItAzfJgBwMoPIUTitYj7pWfI/67Snc4tWecO8zgaFb aHHg== X-Gm-Message-State: AOAM532PkoBxTBbCnv7Jf+Er+Ev3iKSr/zgOplJjhYHjTVhdifhs5elz Pf6LYU1CK9Klh9X9bD5LrURg5W2TTIMssZvLd/6OwpZM0HA= X-Received: by 2002:a17:90b:a17:: with SMTP id gg23mr18709466pjb.129.1607797592321; Sat, 12 Dec 2020 10:26:32 -0800 (PST) MIME-Version: 1.0 References: <20201209234857.1521453-1-alexandre.belloni@bootlin.com> <20201209234857.1521453-4-alexandre.belloni@bootlin.com> In-Reply-To: <20201209234857.1521453-4-alexandre.belloni@bootlin.com> From: Andy Shevchenko Date: Sat, 12 Dec 2020 20:26:16 +0200 Message-ID: Subject: Re: [PATCH 3/6] iio:pressure:ms5637: limit available sample frequencies To: Alexandre Belloni Cc: Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio , devicetree , linux-arm Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 10, 2020 at 2:03 AM Alexandre Belloni wrote: > > Avoid exposing all the sampling frequencies for chip that only support a > subset. > +static ssize_t ms5637_show_samp_freq(struct device *dev, struct device_attribute *attr, char *buf) > +{ > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > + struct ms_tp_dev *dev_data = iio_priv(indio_dev); > + int i, len = 0; > + > + for (i = 0; i <= dev_data->hw->max_res_index; i++) > + len += scnprintf(buf + len, PAGE_SIZE - len, "%u ", ms5637_samp_freq[i]); Doesn't IIO core have a helper? Also, it's better to use sysfs_emit(). > + buf[len - 1] = '\n'; > + > + return len; > +} -- With Best Regards, Andy Shevchenko