Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp2037660lqg; Mon, 4 Mar 2024 10:51:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV4QQtBDEg+2fmB97phTtcV1WrN0TqWUxA4dcEikFDbSycUkAH1brv/w8H39L7+ZzrCByChUSJEwU0rsiC735DqL1e3fs85fe0he41CDw== X-Google-Smtp-Source: AGHT+IG/8YiUEBhxiHFKV0VWxEH0D5M1WJjFAIppyOVrAXUAo9l+w0qJIPuosSUYAceY20X4sThw X-Received: by 2002:ac8:5dd0:0:b0:42e:b20e:b691 with SMTP id e16-20020ac85dd0000000b0042eb20eb691mr14457575qtx.49.1709578276125; Mon, 04 Mar 2024 10:51:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709578276; cv=pass; d=google.com; s=arc-20160816; b=gxnCFaPpqXzQPN+r7T9D0M7kBzlR95/IAO9PGKYFVMiF0r9odhZWiVvsl//+WTcu4g /fkJAjrLjbu3TZJDNvI+ltlzR3Mp9UHlTW6uqNIteOCTonMVBigrvGt/dyYbDHUpD/s+ 0kiKm8deEkbOdcXhFFed6fjQrefGwEZ5OzVvk88dDaplZTqWTSsAG/1s0YMdQo2rD7AR wwdQSyBNnDYNXsiH+1bYAKUPZs5aeTeVuZNgAzeWRlTdQOYXuyPWRBmYH6L7d1kfGXaq Jc/mZevje9XPnEq1b07tF62MMrDOx47vFBS6oa1SZMgca+dXbKcUMXWTBzmx7xO7I518 lFvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from:dkim-signature; bh=eWFpKyxy2sK/uWQlofpzOWO2CjJJHb7rOXZzYRW1nfs=; fh=u+J2JQTW5Vh9qf09XUJEf/dvGYCFm28LFKsSxOziGZk=; b=HZsVfAEU8HH+NPdq0SmhmC8+Bq//HOLMgK+wiNIp08CB1fAQtMHdISjrr8qiNTUBEP YmpFkOn6dqrE9RH0hVzNJmKL5A0lfA8tKAa7FJFdXs9cY5zdAAG1SlwkEsHV532GESU3 NqrM5GK310dTNboJoVIN8PLDIRnIbjQSbeX5r3D5I7Q4CXAo02sekSrVZCVZEYPLaPk2 2GTjrmkvpkjpWR3iHHzitsXs7j9//8fVuFFhmvHGbrDhDiXHrIPC1sFClorJE79iGHMh 2lAQpYbw77174DKabnF+pTzaSkaA7jF8RjWO/Sv1PPb9wBKkDNo0t/G1I4JL2nRT3qSW to0g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OYZ4uoSn; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-91132-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91132-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 22-20020ac85716000000b0042ef7cf36a2si1432472qtw.75.2024.03.04.10.51.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 10:51:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91132-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OYZ4uoSn; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-91132-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91132-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D47671C213B3 for ; Mon, 4 Mar 2024 18:51:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67FD578B5D; Mon, 4 Mar 2024 18:50:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OYZ4uoSn" Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 079D578B44; Mon, 4 Mar 2024 18:50:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709578223; cv=none; b=um8kTWZGvQhitCp5MzEPDl2EoNEyGK8XgrWPfsJ7LMd0rlezIRj85lA31YN0plbLP9KXSosPh706254LkSCNO6Dxei5sE19ZE5B/5srAWAcph3/EWPHmP8XoBaVhwLp0IjhQN/6+CPuxu+SjmSm6o9PMfPcYcRD52FhAufEWkmY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709578223; c=relaxed/simple; bh=7eDOCTzxgjXTz40cs4/kG1usCYFXG1biUAupDWGxh4g=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hnYjcfx6bX6awtnA7RuiNUzArSAge7o4GhQjtjPiXh8q5vU561/u1G5lIZkrK4P3RA1ZvkRa0yWajmzg5A1hxtqTQA6CsdUVgVYGU5eMMFt10GiqxMSwX0ZyOaE5yFdljpR/cJYAFPkVUZFx5vSa+6MNd+wI6+VO+tejzTzagmg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OYZ4uoSn; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a36126ee41eso734387866b.2; Mon, 04 Mar 2024 10:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709578220; x=1710183020; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=eWFpKyxy2sK/uWQlofpzOWO2CjJJHb7rOXZzYRW1nfs=; b=OYZ4uoSnTZAv3stWqenFrq7Vs5gh9PNqk58IAmbc+51Y+BaExrnrV4IuaPijoZOsfu /CAIKsONkeb9/KlLmMQpHTQD0780Ef23ehZE+KALKCEKRfG+tgAk2dxN9/42XojvDyPD caKKtwHTwQ65kxo+ERkSRe5kWMGxp3jEB0gBK0NfdhGsMhhZCC67oLZq4DZ/MogViBoZ xvPM13M8aZnIyEhFK3hxzCYjfeCxBmYwoCXNocxyDir2/2Tx3X4OjEAnL+HxwMPAcaAd 3v1unZf1cDti+uof1gFWQB7SBD1VAtP0axWS0AfDKiXd1pq949iwhH8SfqIYcZPbN61Y Wntg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709578220; x=1710183020; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eWFpKyxy2sK/uWQlofpzOWO2CjJJHb7rOXZzYRW1nfs=; b=AGfX25Np8A1uW34UKgOaup+qJwdY2hcbx4tmfP8j8iV8u6EZOMSfxxAVg2II6DABgv PHq0EyugKmrmfFDZj5HZTyPxBHumqBoBxROwXgPr683sIyQ3EglrzPLXR4E5AkzNYcka LRsfuiGgpV6VNO+cnffjo/tfcVQyw55L+4FAn+7Cih2xPOd4j4gmiNaPL0CV8edmZzrL WSPmBB4kxltqdXKOXFHPCIwzLgcRO5VoTwCFxBCoXiJ/kA4pd2+JjoTKXccjyO+Grry9 NtIyBhaTx3dKfXkzv7L8AT78dSgYsvFXIqjhYsFBEiCHCqEZ3fGtbqHJxxTe1s5iCKOC qSAA== X-Forwarded-Encrypted: i=1; AJvYcCVaeOLe8iJHoAcVdvJDeb8M31l48pUj/MvT6ipRyk4LVJC/97tgxKMOJkWtuE6vhhFnneDydmtVJlyUAAKCt5o3Ziu+OhIN3SYnACSlECuWTz0vLIKwDD3BKqAXwBwt+A221gg7u9YE X-Gm-Message-State: AOJu0YzoqILskILxMZEKdAbFIb2CkAnUfQrkJxRSsh0VmImytMIjHvHu E0ws5Je1InNEitCT+wlYRsLEbfSAeDFFfNVBWzjqkjKQxsg38loC X-Received: by 2002:a17:906:c352:b0:a45:5c4a:2db5 with SMTP id ci18-20020a170906c35200b00a455c4a2db5mr1862119ejb.48.1709578220106; Mon, 04 Mar 2024 10:50:20 -0800 (PST) Received: from vamoiridPC ([2a04:ee41:82:7577:d458:fb5d:c4e5:fb19]) by smtp.gmail.com with ESMTPSA id ag3-20020a1709069a8300b00a44790d06d3sm4243212ejc.71.2024.03.04.10.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 10:50:19 -0800 (PST) From: Vasileios Amoiridis X-Google-Original-From: Vasileios Amoiridis Date: Mon, 4 Mar 2024 19:50:17 +0100 To: Andy Shevchenko Cc: Vasileios Amoiridis , jic23@kernel.org, lars@metafoo.de, ang.iglesiasg@gmail.com, mazziesaccount@gmail.com, ak@it-klinger.de, petre.rodan@subdimension.ro, phil@raspberrypi.com, 579lpy@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] iio: pressure: Add timestamp and scan_masks for BMP280 driver Message-ID: <20240304185017.GA3955@vamoiridPC> References: <20240303165300.468011-1-vassilisamir@gmail.com> <20240303165300.468011-4-vassilisamir@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Mar 04, 2024 at 01:47:47PM +0200, Andy Shevchenko wrote: > On Sun, Mar 03, 2024 at 05:52:59PM +0100, Vasileios Amoiridis wrote: > > The scan mask for the BME280 device which contains humidity > > measurement needs to become different in order for the timestamp > > to be able to work. Scan masks are added for different combinations > > of measurements. The temperature measurement is needed for either > > pressure or humidity measurements. > > ... > > > +enum bmp280_scan { > > + BMP280_TEMP, > > + BMP280_PRESS, > > + BME280_HUMID, > > +}; > > Hmm... Why do we need to actually copy the IIO ones? Can't we use IIO ones > directly (or in some way)? > What do you mean exactly by copying the IIO ones? These values are used as indexes to enable channels in the avail_scan_masks below. > ... > > > +static const unsigned long bmp280_avail_scan_masks[] = { > > + BIT(BMP280_TEMP), > > + BIT(BMP280_PRESS) | BIT(BMP280_TEMP), > > + 0, > > No comma for the terminator line. > > > +}; > > > +static const unsigned long bme280_avail_scan_masks[] = { > > + BIT(BMP280_TEMP), > > + BIT(BMP280_PRESS) | BIT(BMP280_TEMP), > > + BIT(BME280_HUMID) | BIT(BMP280_TEMP), > > + BIT(BME280_HUMID) | BIT(BMP280_PRESS) | BIT(BMP280_TEMP), > > + 0, > > Ditto. > > > +}; > > ... > > > const struct iio_chan_spec *channels; > > int num_channels; > > + const unsigned long *avail_scan_masks; > > unsigned int start_up_time; > > Please, run `pahole` every time you are changing data structure layout. > Here you efficiently wasted 8 bytes of memory AFAICS. > > -- > With Best Regards, > Andy Shevchenko > >