video/hdmi: Constify 'buffer' to the unpack functions

The unpack functions just read from the passed in buffer,
so make it const.

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180920185145.1912-2-ville.syrjala@linux.intel.com
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
This commit is contained in:
Ville Syrjälä 2018-09-20 21:51:28 +03:00
parent f384d7d514
commit f26e1de5ec
2 changed files with 14 additions and 12 deletions

View File

@ -31,7 +31,7 @@
#define hdmi_log(fmt, ...) dev_printk(level, dev, fmt, ##__VA_ARGS__) #define hdmi_log(fmt, ...) dev_printk(level, dev, fmt, ##__VA_ARGS__)
static u8 hdmi_infoframe_checksum(u8 *ptr, size_t size) static u8 hdmi_infoframe_checksum(const u8 *ptr, size_t size)
{ {
u8 csum = 0; u8 csum = 0;
size_t i; size_t i;
@ -1016,9 +1016,9 @@ EXPORT_SYMBOL(hdmi_infoframe_log);
* Returns 0 on success or a negative error code on failure. * Returns 0 on success or a negative error code on failure.
*/ */
static int hdmi_avi_infoframe_unpack(struct hdmi_avi_infoframe *frame, static int hdmi_avi_infoframe_unpack(struct hdmi_avi_infoframe *frame,
void *buffer) const void *buffer)
{ {
u8 *ptr = buffer; const u8 *ptr = buffer;
int ret; int ret;
if (ptr[0] != HDMI_INFOFRAME_TYPE_AVI || if (ptr[0] != HDMI_INFOFRAME_TYPE_AVI ||
@ -1079,9 +1079,9 @@ static int hdmi_avi_infoframe_unpack(struct hdmi_avi_infoframe *frame,
* Returns 0 on success or a negative error code on failure. * Returns 0 on success or a negative error code on failure.
*/ */
static int hdmi_spd_infoframe_unpack(struct hdmi_spd_infoframe *frame, static int hdmi_spd_infoframe_unpack(struct hdmi_spd_infoframe *frame,
void *buffer) const void *buffer)
{ {
u8 *ptr = buffer; const u8 *ptr = buffer;
int ret; int ret;
if (ptr[0] != HDMI_INFOFRAME_TYPE_SPD || if (ptr[0] != HDMI_INFOFRAME_TYPE_SPD ||
@ -1117,9 +1117,9 @@ static int hdmi_spd_infoframe_unpack(struct hdmi_spd_infoframe *frame,
* Returns 0 on success or a negative error code on failure. * Returns 0 on success or a negative error code on failure.
*/ */
static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame, static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame,
void *buffer) const void *buffer)
{ {
u8 *ptr = buffer; const u8 *ptr = buffer;
int ret; int ret;
if (ptr[0] != HDMI_INFOFRAME_TYPE_AUDIO || if (ptr[0] != HDMI_INFOFRAME_TYPE_AUDIO ||
@ -1163,9 +1163,9 @@ static int hdmi_audio_infoframe_unpack(struct hdmi_audio_infoframe *frame,
*/ */
static int static int
hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame, hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame,
void *buffer) const void *buffer)
{ {
u8 *ptr = buffer; const u8 *ptr = buffer;
size_t length; size_t length;
int ret; int ret;
u8 hdmi_video_format; u8 hdmi_video_format;
@ -1234,10 +1234,11 @@ hdmi_vendor_any_infoframe_unpack(union hdmi_vendor_any_infoframe *frame,
* *
* Returns 0 on success or a negative error code on failure. * Returns 0 on success or a negative error code on failure.
*/ */
int hdmi_infoframe_unpack(union hdmi_infoframe *frame, void *buffer) int hdmi_infoframe_unpack(union hdmi_infoframe *frame,
const void *buffer)
{ {
int ret; int ret;
u8 *ptr = buffer; const u8 *ptr = buffer;
switch (ptr[0]) { switch (ptr[0]) {
case HDMI_INFOFRAME_TYPE_AVI: case HDMI_INFOFRAME_TYPE_AVI:

View File

@ -332,7 +332,8 @@ union hdmi_infoframe {
ssize_t ssize_t
hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, size_t size); hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, size_t size);
int hdmi_infoframe_unpack(union hdmi_infoframe *frame, void *buffer); int hdmi_infoframe_unpack(union hdmi_infoframe *frame,
const void *buffer);
void hdmi_infoframe_log(const char *level, struct device *dev, void hdmi_infoframe_log(const char *level, struct device *dev,
union hdmi_infoframe *frame); union hdmi_infoframe *frame);