Received: by 2002:ac8:3b51:0:b0:3f3:9eb6:4eb6 with SMTP id r17csp2747983qtf; Mon, 12 Jun 2023 09:13:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UkeBFU8VxeLVqWOF2nEHB4V9BIYpLydF4LqTXM8XoaA0EKluODBx3aN98gNC+vh1ZskZz X-Received: by 2002:a05:6402:12c7:b0:514:a5fe:b304 with SMTP id k7-20020a05640212c700b00514a5feb304mr5853870edx.38.1686586390975; Mon, 12 Jun 2023 09:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686586390; cv=none; d=google.com; s=arc-20160816; b=w9eCZqi/UiVPzPfQXvi6KjoHrsQ9Aziqf7NWo7gXVrPZ/aM0L4vVoPhMFnSnZ7HZdT Cq5c8nRtQQIR255rQTts5dO5tjiWM4v2eSxygvxSAtoY4JiIZ6MLrRXFBqPwHQvF+R6w tT8wPRRHfnGNhOEQ0Vl2qWSqUnBeVqmDvxkY25UGWHoUwvN+Z7eLAB1buGyubL+VIcQj m20L2dRVkCr0aTYdj7atMpaLQQP/YqGDDIwXk5oSEJ7bs+GN2DW0O69PZhLM7zwgi00b M9WmPv5FnLrBEBcTTRumQXKO80uAXy4hf0E4gEInqA7j6lSFZfDLC+iAMeOiDcwAY90X 7OcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=f2IjN69N8IfZ3tQvCeygt1QUed0bdpc5sTXxWC2RHO8=; b=mVDGC2vRniqfDEK/6iPxdW4bcKCIJOrZWtQzt/Br9LLmy2vlko42kat9UDdPjcPAxv 9lvaNmh0L4+O1osrPRjcdVIi5DXfvImWNJ+J9mcZPLpnMw1af/mGqU+CoCfT2/vrP9TO vQVGe+CLNb5QqG4vwTKe2R+LnayJ6k0c1Wass2Qo024RWjJ/7Vg22dYNmPpmEu6luygb RLdGOSGLP0piM5MKk5IoTHAlMFiB9+IO2WbuqXouRi51higWvP+r/rsVaivIfJtQlTD7 8dpqX/5l/wsYZX2k1eevS257lmHiPQb2esv8NkKr0WhNyfRkb2gWjkHTqnCJ68cfC+jm fipQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gnMsU8+f; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020aa7d551000000b005148e9489b6si1589792edr.330.2023.06.12.09.12.45; Mon, 12 Jun 2023 09:13:10 -0700 (PDT) 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=@intel.com header.s=Intel header.b=gnMsU8+f; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237858AbjFLP4S (ORCPT + 99 others); Mon, 12 Jun 2023 11:56:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239104AbjFLP4E (ORCPT ); Mon, 12 Jun 2023 11:56:04 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 802FDCA; Mon, 12 Jun 2023 08:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686585363; x=1718121363; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=V3bEUjQ1to0LdMiTIveRka4/accmCyL64o9ed0zW8PI=; b=gnMsU8+fCrP8wwgIlS1ishp65QpbfJJAnVoEomnfMlixu3xM/gwnnLFF wnmA+8JPsE45NpMA7EYotpbZ290pQyZsIfhKa8d3X+JDgi+SvvKY6kfSq sjBswEj8Qyd98XUpL7x7mn+vKhr6d53I6Bah/3Fn80qMd2goLB7L9qczM Ou88IJJa2m1N21Y2/aDmp5AxJ9SlUXXflKsxvQoFESvx428QZxQ8I5pHQ dgV0NjJnV7HZKgUnrTyxuxYmIUs7hgJLtK/xFyGZ18bytyg6Z2jceyFTE 6kbjS9k+0y4YiizYtqq6M7U9RmGeA72zlq7ijaw4dvLAEcFrGhHHV+chE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="386472754" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="386472754" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 08:56:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="781264000" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="781264000" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga004.fm.intel.com with ESMTP; 12 Jun 2023 08:56:01 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1q8jtf-0039Vn-1w; Mon, 12 Jun 2023 18:55:59 +0300 Date: Mon, 12 Jun 2023 18:55:59 +0300 From: Andy Shevchenko To: Mehdi Djait Cc: jic23@kernel.org, mazziesaccount@gmail.com, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v5 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 On Mon, Jun 12, 2023 at 04:22:09PM +0200, Mehdi Djait wrote: > Since Kionix accelerometers use various numbers of bits to report data, a > device-specific function is required. > Implement the function as a callback in the device-specific chip_info structure ... > +static int kx022a_get_fifo_bytes(struct kx022a_data *data) > +{ > + int ret, fifo_bytes; > + > + ret = regmap_read(data->regmap, KX022A_REG_BUF_STATUS_1, &fifo_bytes); > + if (ret) { > + dev_err(data->dev, "Error reading buffer status\n"); > + return ret; > + } > + > + if (fifo_bytes == KX022A_FIFO_FULL_VALUE) > + fifo_bytes = KX022A_FIFO_MAX_BYTES; You can return this constant directly. > + return fifo_bytes; > +} -- With Best Regards, Andy Shevchenko