From patchwork Wed Mar 16 21:18:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 8604881 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 121AE9F294 for ; Wed, 16 Mar 2016 21:18:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CBAA2026F for ; Wed, 16 Mar 2016 21:18:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4EEB5202A1 for ; Wed, 16 Mar 2016 21:18:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755539AbcCPVSw (ORCPT ); Wed, 16 Mar 2016 17:18:52 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:34414 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbcCPVSw (ORCPT ); Wed, 16 Mar 2016 17:18:52 -0400 Received: by mail-wm0-f49.google.com with SMTP id p65so207935133wmp.1 for ; Wed, 16 Mar 2016 14:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=Ws/RyJK2BnVXH21zdzp8A93oLxhzqfGq/G0SQsok7Gg=; b=j5r8vYKTj/2XgCtD/1zTR0R3rfZJ5RB6JL6HNeGsD1lN+VHlX87UmfowmgQj+xqIuN BAliZZytyyIXL3DzucHsNq0bUljrslvkMpqHv9F1BMBfl5hDCTa4FWO9weXz7NkqHXzt WEwPLc6WgEqEl1x1vPAFcqpT6fYv8Eny+BkT83AFt4YVTS45CmyNYImQU3V6wAGUC8um Nci8YPz00JJFapPL+y1RZ/ps25tXIWfy2NKkiLNvsypcBPvSvDJmpj4cgVm62ATQNNf5 N/zAsxFyjhjpydsEqdF9Iq7MTQtUskOb05Mzb5wy4JvMlfdrmezFDxxYINDKmC3dVQ8E dFEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=Ws/RyJK2BnVXH21zdzp8A93oLxhzqfGq/G0SQsok7Gg=; b=V5uThg21zMHwabb84pGBeLHrkvvhvYl6fyn4Lxn2nR0UGYShMiDXyjI5FFVMCTNQH0 BMbTABWnBp/T3F8KsYtvpH2IC/E4LqcPPWQI8Ki21Us8PXb4qcLMFz41rJi0wIKiQF9S Dz+IgT7TSggMVhwYpUUfNlbVed+x9V2qsD/9CLzJ0yis+RH39+WSevrTA92FS3jtyKc6 om8wknPB2lm8ozrcTdQiS+Ii7x1KtqAY6NlTi6hQ2wEh0eegbdQCkX6YEegph1OHdmt+ 49bCGdt+SSMGkx9CiK/ubZ7cPbai6i6ZTvNsNd4Wk7kdjkjqhvpgnRYVGJck/Q6JPrv+ qPrg== X-Gm-Message-State: AD7BkJIjZb5bSmH71qwNtpfQKL7QauUF2jNZjzJtMjM+JeaTY4yahIYJE2+WdGPpYQyslw== X-Received: by 10.194.192.36 with SMTP id hd4mr5681580wjc.85.1458163130638; Wed, 16 Mar 2016 14:18:50 -0700 (PDT) Received: from ?IPv6:2003:62:5f55:ba00:b4b0:f51e:6af1:6c89? (p200300625F55BA00B4B0F51E6AF16C89.dip0.t-ipconnect.de. [2003:62:5f55:ba00:b4b0:f51e:6af1:6c89]) by smtp.googlemail.com with ESMTPSA id g3sm4727556wjw.31.2016.03.16.14.18.49 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Mar 2016 14:18:49 -0700 (PDT) To: Mauro Carvalho Chehab , linux-media@vger.kernel.org From: Heiner Kallweit Subject: [PATCH] media: rc: reduce size of struct ir_raw_event Message-ID: <56E9CDAE.2040200@gmail.com> Date: Wed, 16 Mar 2016 22:18:38 +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 --- include/media/rc-core.h | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 0f77b3d..b8f27c9 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -214,27 +214,17 @@ enum raw_event_type { struct ir_raw_event { union { - u32 duration; - - struct { - u32 carrier; - u8 duty_cycle; - }; + u32 duration; + u32 carrier; }; - - unsigned pulse:1; - unsigned reset:1; - unsigned timeout:1; - unsigned carrier_report:1; + u8 duty_cycle; + u8 pulse:1; + u8 reset:1; + u8 timeout:1; + u8 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) {