From patchwork Thu Mar 17 19:39:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 8614011 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EB6949F3D1 for ; Thu, 17 Mar 2016 19:39:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2137620306 for ; Thu, 17 Mar 2016 19:39:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 409F32026C for ; Thu, 17 Mar 2016 19:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933743AbcCQTjd (ORCPT ); Thu, 17 Mar 2016 15:39:33 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34619 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932532AbcCQTjc (ORCPT ); Thu, 17 Mar 2016 15:39:32 -0400 Received: by mail-wm0-f68.google.com with SMTP id p65so1594961wmp.1 for ; Thu, 17 Mar 2016 12:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=ntP7U9SQaSp0HGtwUy3Qy+YxLiSVsmxA+jK9X2a/T48=; b=Gvvjme7Hz9/mbJHb1A1LS+PzhNd6B+VqboOUFrw0J2IaIgTRU5GfeNVT/UVFdh7NbS pMW+znG17iUFUeWt3R4eHHe9zAJHcSMNGLsaXv1mbXcVQlyhu0/wo6SbSkipI4Kpz0Lk QS5nIdtXa3GRe0MbijDgBZWzGLCVNNVL5AC4HNPIlFUJUbyElU2jKfVRF0hbygfC5L2C yg7XkLy4TXw0aVjh37E48kis6OG9nvt4ZK3Y4GyKTvoLD142YTADR4gho8NHDelIIAjN k/+7kBCEAsk82BrzffE55U2qcAs7PHuUENUYJJ8gOVc85orfdwl2JzSWrP6znb4UWUaS 2gog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=ntP7U9SQaSp0HGtwUy3Qy+YxLiSVsmxA+jK9X2a/T48=; b=lZ9APoVen35nE01eesbCwbx4OFpytN5jcujhQ0AlXJXz+bpxTF/fw+qGhR4pRw6TRy 92WC2lR8Brf/XBBRaqJ+sY0lf/kx297A//H2lPB0aIjnW7RYs6NAE2pwTS0gxga3GlpI cGo4Iix7+ZP6pl3hPY/JDACpOsv0lkrpNJPr/PlN/Z6K85nknztWcFoP5+AD7uGe4mQ+ UT+Hht8etyDQRviRzZ6bxFen36zSp+0lZlusLyutFk2TObyUfWMRoI1sLDKNCw0rOnQ6 0a6+Hg6FBvZIdBhvTCdhFu/8RMiuZODnEOH49l6I0N4cUMV0jlicWnWnrv30gggei1MB E47g== X-Gm-Message-State: AD7BkJI9Xw3Bq1wyVDS3EZbRYIoEAL4bpoYALgUD0S7Rj9A1YDwvreRlxQJ1ScoqePYHFA== X-Received: by 10.194.84.2 with SMTP id u2mr11790688wjy.61.1458243570752; Thu, 17 Mar 2016 12:39:30 -0700 (PDT) Received: from ?IPv6:2003:62:5f55:ba00:9942:f71c:a46f:e4d0? (p200300625F55BA009942F71CA46FE4D0.dip0.t-ipconnect.de. [2003:62:5f55:ba00:9942:f71c:a46f:e4d0]) by smtp.googlemail.com with ESMTPSA id v188sm31400371wmv.3.2016.03.17.12.39.29 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Mar 2016 12:39:30 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v2] media: rc: reduce size of struct ir_raw_event To: Mauro Carvalho Chehab , Sean Young Cc: linux-media@vger.kernel.org Message-ID: <56EB07E1.5030701@gmail.com> Date: Thu, 17 Mar 2016 20:39:13 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP struct ir_raw_event currently has a size of 12 bytes on most (all?) architectures. This can be reduced to 8 bytes whilst maintaining full backwards compatibility. This saves 2KB in size of struct ir_raw_event_ctrl (as element kfifo is reduced by 512 * 4 bytes) and it allows to copy the full struct ir_raw_event with a single 64 bit operation. Successfully tested with the Nuvoton driver and successfully compile-tested with the ene_ir driver (as it uses the carrier / duty_cycle elements). Signed-off-by: Heiner Kallweit --- v2: - don't change type of bit field members --- include/media/rc-core.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 0f77b3d..f6f55b7 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -215,12 +215,9 @@ enum raw_event_type { struct ir_raw_event { union { u32 duration; - - struct { - u32 carrier; - u8 duty_cycle; - }; + u32 carrier; }; + u8 duty_cycle; unsigned pulse:1; unsigned reset:1; @@ -228,13 +225,7 @@ struct ir_raw_event { unsigned carrier_report:1; }; -#define DEFINE_IR_RAW_EVENT(event) \ - struct ir_raw_event event = { \ - { .duration = 0 } , \ - .pulse = 0, \ - .reset = 0, \ - .timeout = 0, \ - .carrier_report = 0 } +#define DEFINE_IR_RAW_EVENT(event) struct ir_raw_event event = {} static inline void init_ir_raw_event(struct ir_raw_event *ev) { @@ -256,8 +247,7 @@ void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); static inline void ir_raw_event_reset(struct rc_dev *dev) { - DEFINE_IR_RAW_EVENT(ev); - ev.reset = true; + struct ir_raw_event ev = { .reset = true }; ir_raw_event_store(dev, &ev); ir_raw_event_handle(dev);