Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3727081ybx; Mon, 4 Nov 2019 01:50:11 -0800 (PST) X-Google-Smtp-Source: APXvYqy50wu93uLha3zWZj79UsFOyu4fx8oKHWP4mDzhfdi4EntVP/yz4ouh3Yl+yX8rtWqi/zAz X-Received: by 2002:a17:906:245b:: with SMTP id a27mr23305183ejb.192.1572861011074; Mon, 04 Nov 2019 01:50:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572861011; cv=none; d=google.com; s=arc-20160816; b=B6c3pJGb6p8On2FBtfvUtGLBw5EYP8BdnLG59k1XTl+2TcSIbeIcTKtuF94jVHiZn7 UNNAGrbnENQi2LNBlzgcFBGWquMh0EfUuPI5c4/QPEoPhMXluKd2O4K2/STJKKsR2vbu t8THRByojDW85QroXqPIR3fXgz6ZYKf9hN74NbJ0JOY+XBGkNdIoYKnd7wkouQKj9656 8ZoYdUfnwP9u6kWZ/QHRRvwtYG00o/h5/M4CaQeenNGZgq2kH7LqwxiWK0ny0FyGcvea y8dyyBq7CWUrSuR1fwmp8zflOCDR5Xc+TRBRuM6gNjuq9IOtNb4kQgnfN/QFb8PhvZC7 sw3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=5VHfpHtV/8HPb0l/IPk1e5QVs/Qe5EEs7a7oJ0I59JI=; b=uJ6M7R321FdVXvPHOqel6EPrFC9UcRktPEquZdPmAjLnFGzQyzxagBtbpcmxx+ZyRD 1oSMDafzR+OIu7WwnSOZQQB96THg1ccRx3KKchOP5pCFzoVWjvqvXVIrqAJV1p8QDUSm 9Q1IIjg6k7ZytpWATY1/PFxG9S3/+JPUstqT5MpA5SSwua3AXFyiROFkWHYdpXU0voan CUzVgXiVYiZ1JJPiSp4gF5Xj+9bKwbRCXiBwLeASLLkN9CAEM2VcMHVRPOzHrAWDaHS5 tjIeawZBIVkEwbdG9DIKby8FvYzFsYGF8PzExypn95165a9LkgK+2sB4bB8mWF5V/0F1 R7VQ== ARC-Authentication-Results: i=1; mx.google.com; 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 k24si4204379ejv.111.2019.11.04.01.49.48; Mon, 04 Nov 2019 01:50:11 -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; 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 S1728216AbfKDJsX (ORCPT + 99 others); Mon, 4 Nov 2019 04:48:23 -0500 Received: from lb1-smtp-cloud9.xs4all.net ([194.109.24.22]:34191 "EHLO lb1-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727788AbfKDJsX (ORCPT ); Mon, 4 Nov 2019 04:48:23 -0500 Received: from [192.168.2.10] ([46.9.232.237]) by smtp-cloud9.xs4all.net with ESMTPA id RYy9ia8hj9P9bRYyCiVURr; Mon, 04 Nov 2019 10:48:21 +0100 Subject: Re: [PATCH v3 2/5] media: v4l2_ctrl: Add const pointer to ctrl_ptr To: Ricardo Ribalda Delgado , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191101112358.29538-1-ribalda@kernel.org> <20191101112358.29538-2-ribalda@kernel.org> From: Hans Verkuil Message-ID: Date: Mon, 4 Nov 2019 10:48:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191101112358.29538-2-ribalda@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfJha0gJ1KEmyVTk2Jm6QFvRIitQcWYdXEW0+MMsdBZum6JAlJJoDqy1IvYJglMseOLcrPFNbZFsSlPGDuI62eaCPQE2o3YKIUsjonAggUULEAF4Lxny6 cOqTU+yoKJmEbWjZfH//y0msGWnxD/NCSyJiyw0zNAIHAI56pIXvI/Iuk6sPRVXvAIKv9UaDxjSG5o5lOtOC4jDQkB9FhBzTKYjqQRcmK4XdRHmrQ4ovbEhD OmAhDYazfOTHOfTqFSk1qg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ricardo, On 11/1/19 12:23 PM, Ricardo Ribalda Delgado wrote: > This pointer is used to point to data that is constant. Thanks to this > we can avoid a lot of casting and we make more clear when the data is > constant or variable. > > Suggested-by: Hans Verkuil > Signed-off-by: Ricardo Ribalda Delgado > --- > include/media/v4l2-ctrls.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h > index 78a97b10c89e..7db9e719a583 100644 > --- a/include/media/v4l2-ctrls.h > +++ b/include/media/v4l2-ctrls.h > @@ -56,6 +56,7 @@ struct poll_table_struct; > * @p_hevc_slice_params: Pointer to an HEVC slice parameters structure. > * @p_area: Pointer to an area. > * @p: Pointer to a compound value. > + * @p_const: Pointer to a constant compound value. > */ > union v4l2_ctrl_ptr { > s32 *p_s32; > @@ -78,6 +79,7 @@ union v4l2_ctrl_ptr { > struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; > struct v4l2_area *p_area; > void *p; > + const void *p_const; > }; > > /** > This addition makes it possible to use const void pointers elsewhere in the control framework. E.g. in std_equal you can use p_const in the memcmp at the end. Can you go through the v4l2-ctrls.c source and replace .p by .p_const where it makes sense? Obviously this would be a separate patch. Regards, Hans