Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp165864imu; Wed, 2 Jan 2019 16:49:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN6VQGNqMl459k+Gjt/RHyLKt4m31WeM/da7irENNrtK/f4hoX2B9jm+2B5BdVcM+ZQkWZDh X-Received: by 2002:a17:902:1127:: with SMTP id d36mr43998435pla.299.1546476591498; Wed, 02 Jan 2019 16:49:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546476591; cv=none; d=google.com; s=arc-20160816; b=An96SEtoYWLm559yK5GsB6u1wC6NkMWbCqnei+ufzUjtORWr2ota99STSlnpbXSIyV wKuv5ug0AWyEGpyz9jwJ8mwJ4mfsrrvL0BU2+hLKfbmEX2kcaTmZ629n5io+khKNE9nP G8oFArGeXJLA9BfbchayTbOUUrE5i0zIeSG9dd/YpZl7fllzIgTCe69WKpO3NaIqzYqX wkXYTYWm/YH2Z70Opy6+osJN4utsMOZKxqnu3IabQmjbbvI9Rsrmn9fZzKgmj+rd+s/l //B/A17ocYjYiBZYJL/RE9ewHZb+QDIzoafGL1qxwQ0O3ZDMGKKpazZiWCUSZfmmQshO 3Q0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=1R9fDNLKzK/DHJVcx+9QWLyfDT+tFplpDcNxwCy2mIQ=; b=SguEKDymwfggVtGli5NhoaJ0pZwjyZ0oWoT+pPoR5eVlmiDfpLJP7aCySzMpULYx3n MuZ03wu3d35ZkYd4re/rWpI29hvnkk9jztl4rWrHI384axVVpb8w2iSkX/6eEvYbaeGb /J2MXWpkFe3P4Sv5R0Z+RNW/H8ZX1L7FwKhRdNebiBMJUBrFQQOrF6kHWVrEMqGUpdSH h2BUqNof2QshaAaxzJ0KbJ0Vv3Mdbjgjun1vcmkWE134V5I39RYKWo92fk8OHk58qL4y /MmLBhh0BhBHjrPz1MIqLeS02wZZ2a9bLoVAM52De7rxtUfrhwrjL0QP2UwDBRiP9cdF m8Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@konsulko.com header.s=google header.b="SiP/BPXN"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si49439543pgg.382.2019.01.02.16.49.28; Wed, 02 Jan 2019 16:49:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@konsulko.com header.s=google header.b="SiP/BPXN"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726108AbfABVZa (ORCPT + 99 others); Wed, 2 Jan 2019 16:25:30 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46239 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbfABVZ3 (ORCPT ); Wed, 2 Jan 2019 16:25:29 -0500 Received: by mail-pf1-f193.google.com with SMTP id c73so15693158pfe.13 for ; Wed, 02 Jan 2019 13:25:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=1R9fDNLKzK/DHJVcx+9QWLyfDT+tFplpDcNxwCy2mIQ=; b=SiP/BPXNIKXOen9BlTC8DP6NgotfETsnHbO+KMRRXWx3LCOqbo2/ljKfMGPN88k7Be mYdWERme9+9lCOwDob8UohqvYnLBvL3LedIX8Xq68VfB+FgitH6PXMsUhP4EGRHlqEm8 7FqCggkq2Bd4fkifEzWGRYqxDhnQRqrQx+p7A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=1R9fDNLKzK/DHJVcx+9QWLyfDT+tFplpDcNxwCy2mIQ=; b=I3rPV8RhfeTeJeEVuKBCQ4Z1zB0sWsp+tKzDjdWED0agIEdDp7iLw/nqaaRjLvIV1M xVYOxuLO9R5EnhDHAnuYejl4Y+peKg6VVc4jcItk+5kdeoH1jZB+YCCZhpG0doz/jaOn 5t7P8gURTVC5nr0ucQD4eqyqS62jW2Oyt9ymRzDkz7fM2S8Rbom7jJZTRdRB76kdIUwV LmYjzKBGNOcJYroY4WkVCobGz6FAtVNzaU4g8kAkOx4VvCQBlvi1UT0nBuzH6E1AkDO+ zmbkl/P+vPcttVGmVcn5XR5hv+gtAUtauvI07X5ktWTJ/ORT8+TObbRhCOEaYfkOYkSJ od+Q== X-Gm-Message-State: AA+aEWZoMpT9oX4nq+sGI5ZTPw9F1UV50LuNkR/ZiKgcZR71T6PL4LBn tK/Iv7gArs8XcWaBZuOWkCY8sA== X-Received: by 2002:a62:fc8a:: with SMTP id e132mr45124147pfh.176.1546464329093; Wed, 02 Jan 2019 13:25:29 -0800 (PST) Received: from ?IPv6:2607:fb90:323d:1279:cc3d:efbc:3e13:b6a? ([2607:fb90:323d:1279:cc3d:efbc:3e13:b6a]) by smtp.gmail.com with ESMTPSA id v190sm76861513pfv.26.2019.01.02.13.25.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Jan 2019 13:25:28 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] Staging: iio: ad7192: replaced bool in struct From: Matt Ranostay X-Mailer: iPhone Mail (16C101) In-Reply-To: <20181224095823.GA17061@himanshu-Vostro-3559> Date: Wed, 2 Jan 2019 13:25:27 -0800 Cc: Amir Mahdi Ghorbanian , lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <8E720BF2-7AFC-4FFA-8FA2-5A403FD5DD1D@konsulko.com> References: <1545434786-15220-1-git-send-email-indigoomega021@gmail.com> <20181224095823.GA17061@himanshu-Vostro-3559> To: Himanshu Jha Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Dec 24, 2018, at 01:58, Himanshu Jha wrot= e: >=20 >> On Fri, Dec 21, 2018 at 03:26:26PM -0800, Amir Mahdi Ghorbanian wrote: >> Replaced bool in struct with unsigned int bitfield to conserve space and >> more clearly define size of varibales Important thing to note is depending on padding, alignment, and position of f= ield it probably won=E2=80=99t save any space. Also for internal unpacked structures it really makes little sense to save a= few bytes of data. Don=E2=80=99t read into that packed structures are good.= . they usually aren=E2=80=99t :) - Matt >>=20 >> Signed-off-by: Amir Mahdi Ghorbanian >> --- >=20 > There was some discussion on this at Outreachy list: > https://groups.google.com/d/msg/outreachy-kernel/xpQAl-Gn8HA/yqcQRG_qBgAJ >=20 > I think unless you post some statistics about 'conserving' space,=20 > it is unlikely that maintainers will apply it. >=20 > This idea was originally given by Linus and that thread of discussion=20 > is worth reading too. >=20 >> drivers/staging/iio/adc/ad7192.h | 14 +++++++------- >> 1 file changed, 7 insertions(+), 7 deletions(-) >>=20 >> diff --git a/drivers/staging/iio/adc/ad7192.h b/drivers/staging/iio/adc/a= d7192.h >> index 7433a43..7d3e62f 100644 >> --- a/drivers/staging/iio/adc/ad7192.h >> +++ b/drivers/staging/iio/adc/ad7192.h >> @@ -35,13 +35,13 @@ struct ad7192_platform_data { >> u16 vref_mv; >> u8 clock_source_sel; >> u32 ext_clk_hz; >> - bool refin2_en; >> - bool rej60_en; >> - bool sinc3_en; >> - bool chop_en; >> - bool buf_en; >> - bool unipolar_en; >> - bool burnout_curr_en; >> + unsigned int refin2_en : 1; >> + unsigned int rej60_en : 1; >> + unsigned int sinc3_en : 1; >> + unsigned int chop_en : 1; >> + unsigned int buf_en : 1; >> + unsigned int unipolar_en : 1; >> + unsigned int burnout_curr_en : 1; >> }; >>=20 >> #endif /* IIO_ADC_AD7192_H_ */ >> --=20 >> 2.7.4 >>=20 >=20 > Goodluck! >=20 > --=20 > Himanshu Jha > Undergraduate Student > Department of Electronics & Communication > Guru Tegh Bahadur Institute of Technology