From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22B8E1D5AAB; Thu, 26 Sep 2024 15:01:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727362874; cv=none; b=sakCdAPfJMzThogyVJLj/COcVaC4tepXldTGx5EPr0izbobv8g6RbZ89NyU0tvEvGEES5L2zFfSQ32Z25BBHHDRuX+IzJfzfxzN4toiYSFi5+m8ahAB9pTzUUXcHWulVNDsE+BnzI6w+84kJL2t/06NYZN9bZraobSLyDN6AjYw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727362874; c=relaxed/simple; bh=ekicD0hMIKrGIHgqbzt/2p5OLpTYrMqW/2awOrbsZVE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=udLkt/2wwONxFd5wW4Z04jwlUNoHn0tb07a53IwEK1hOQDdiIHDAypwfZMe1ptjKevsP9MhWBRbFZ7TWq9VkSASj9pTpFOhTdKIxwpQRh1DGir7xkrdw/TY28TodlaUa4CHTLDi2SY0oo2uXN88U+4r5KL02RrC+Gl5Nd86HOUI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=fail smtp.mailfrom=kernel.org; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=kernel.org X-CSE-ConnectionGUID: KxdZcZScS+aU5K6ksf9spA== X-CSE-MsgGUID: OIh4p77BThegUrhdGVai2Q== X-IronPort-AV: E=McAfee;i="6700,10204,11207"; a="25970351" X-IronPort-AV: E=Sophos;i="6.11,155,1725346800"; d="scan'208";a="25970351" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2024 08:00:32 -0700 X-CSE-ConnectionGUID: 4nydMnQqQaeHa6OB7GEjVg== X-CSE-MsgGUID: +Y9PVB2cStqZshl1QyoxYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,155,1725346800"; d="scan'208";a="71863255" Received: from smile.fi.intel.com ([10.237.72.54]) by fmviesa007.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2024 08:00:27 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.98) (envelope-from ) id 1stpyh-0000000DEQN-4AQy; Thu, 26 Sep 2024 18:00:23 +0300 Date: Thu, 26 Sep 2024 18:00:23 +0300 From: Andy Shevchenko To: David Lechner Cc: Antoniu Miclaus , Jonathan Cameron , Lars-Peter Clausen , Michael Hennerich , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nuno Sa , Olivier Moysan , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Marcelo Schmitt , =?iso-8859-1?Q?Jo=E3o_Paulo_Gon=E7alves?= , Mike Looijmans , Dumitru Ceclan , AngeloGioacchino Del Regno , Alisa-Dariana Roman , Sergiu Cuciurean , Dragos Bogdan , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-pwm@vger.kernel.org Subject: Re: [PATCH 6/7] iio: adc: ad485x: add ad485x driver Message-ID: References: <20240923101206.3753-1-antoniu.miclaus@analog.com> <20240923101206.3753-7-antoniu.miclaus@analog.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, Sep 26, 2024 at 04:39:18PM +0200, David Lechner wrote: > On Mon, Sep 23, 2024 at 12:17 PM Antoniu Miclaus > wrote: ... > > +static int ad485x_find_opt(bool *field, u32 size, u32 *ret_start) > > +{ > > + int i, cnt = 0, max_cnt = 0, start, max_start = 0; > > + > > + for (i = 0, start = -1; i < size; i++) { > > + if (field[i] == 0) { > > + if (start == -1) > > + start = i; > > + cnt++; > > + } else { > > + if (cnt > max_cnt) { > > + max_cnt = cnt; > > + max_start = start; > > + } > > + start = -1; > > + cnt = 0; > > + } > > + } > > + > > + if (cnt > max_cnt) { > > + max_cnt = cnt; > > + max_start = start; > > + } > > + > > + if (!max_cnt) > > + return -EIO; > > EIO seems an odd choice since this function doesn't actually do any > I/O. Maybe EINVAL would be better? I would even go with -ENOENT as function called 'find'. > > + *ret_start = max_start; > > + > > + return max_cnt; > > +} -- With Best Regards, Andy Shevchenko