From patchwork Mon Sep 30 10:18:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 11166361 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2C3013B1 for ; Mon, 30 Sep 2019 10:19:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A70FA2190F for ; Mon, 30 Sep 2019 10:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569838745; bh=F7PU0XTzulJyYozp4p3TKjIBYzu0jmLbK1kiwEtvVSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=G67Mlz0ZjkayHzS5U5TNYXrKzfcpT4Me3quVg8CmNw8nLz9gHr9l1YrIyDCPb1Udx B5alQ98iM3khEKgj/aTaGbhf+NU7cCnr92rbRNUiqZZDjjG4mop/o4C4j4PeGlIwrs p3nmY0v6XrFyBDgKBgdSSF2cFSQioluhK72OmMoU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730739AbfI3KTE (ORCPT ); Mon, 30 Sep 2019 06:19:04 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35468 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730694AbfI3KS4 (ORCPT ); Mon, 30 Sep 2019 06:18:56 -0400 Received: by mail-lj1-f196.google.com with SMTP id m7so8852414lji.2; Mon, 30 Sep 2019 03:18:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u6PH07eWhP9yLzHtDWmI6SB0uTSpZSpElPRT+7mhohA=; b=CFDdOBG9XbQ5nZvmw0GinZmQD/aOP56uIdRhkb0d5rht1mwl4hchAhNUPrEr/YyTBi fP+OhQUhUagTxp0VHvkTE1VQD0Qovo/9Ay9bLvj1coNzkmRzwm0Qv+gYaX9cPGk270RW WtaJSiE4ZZbDSB15qIoJpm+bJCDFyNNXGuQMN/UU7gVtP4LFc2wZr0XgV4gQ23r9yJR2 ztXUCzasth4GaQmlaj+tM+6bt49NChPDmQ5QtcOOG5IrH+U4ndQZ0M4yqQE9fo4wp5a4 o3l6gzfehmcQY46M3ETuwCAAjoFrqQxUjiYAy/CbbTnA4Uju4OLlO9lj8LiOBrBeExnV TkTQ== X-Gm-Message-State: APjAAAUYkS+VeMaX3T5hXrwltv7CxIF3VsDN1RFc1IsdcS5/tRRq6SM1 PxiUf+0so9SXHcKRWpMYZU8= X-Google-Smtp-Source: APXvYqy/J8Nltz74xeY945qkmg7xT8cKGfK1+u/0Y07eu0Zo3jTlJVYLUuRSJdb3JMWVBKuUEQ9feQ== X-Received: by 2002:a2e:90d9:: with SMTP id o25mr7903132ljg.94.1569838733873; Mon, 30 Sep 2019 03:18:53 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by smtp.gmail.com with ESMTPSA id z8sm3805970lfg.18.2019.09.30.03.18.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 03:18:52 -0700 (PDT) From: Ricardo Ribalda Delgado To: Philipp Zabel , Hans Verkuil , Jacopo Mondi , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado , Hans Verkuil Subject: [PATCH v8 7/8] media: v4l2-ctrl: Add new helper v4l2_ctrl_ptr_from_void Date: Mon, 30 Sep 2019 12:18:40 +0200 Message-Id: <20190930101841.19630-8-ribalda@kernel.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190930101841.19630-1-ribalda@kernel.org> References: <20190930101841.19630-1-ribalda@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This helper function simplifies the code by not needing a union v4l2_ctrl_ptr and an assignment every time we need to use a ctrl_ptr. Suggested-by: Hans Verkuil Signed-off-by: Ricardo Ribalda Delgado --- include/media/v4l2-ctrls.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index c42f164e2c9e..d69cfdffd41d 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -73,6 +73,17 @@ union v4l2_ctrl_ptr { void *p; }; +/** + * v4l2_ctrl_ptr() - Helper function to return a v4l2_ctrl_ptr from a + * void pointer + * @ptr: The void pointer + */ +static inline union v4l2_ctrl_ptr v4l2_ctrl_ptr_from_void(void *ptr) +{ + BUILD_BUG_ON(sizeof(union v4l2_ctrl_ptr) != sizeof(void *)); + return (union v4l2_ctrl_ptr) ptr; +} + /** * struct v4l2_ctrl_ops - The control operations that the driver has to provide. *