Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3025466pxk; Mon, 21 Sep 2020 03:25:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxax/UVg8RyR9WR5rFX9oFIuRss9MKFZvXFH0qHik5eg8xEfjUhb0hl47Lp/7vhuRceowPX X-Received: by 2002:a17:906:1787:: with SMTP id t7mr50881657eje.173.1600683941830; Mon, 21 Sep 2020 03:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600683941; cv=none; d=google.com; s=arc-20160816; b=bgR/UjF91v/qT4Se62uuX3w2b3otjCX0Psi17/kKvJrH0+u1E1X/+GhIW23dlEOk9M DgU4KIOp/nfwGaX+p+T/TDi/aeaEC2r280z5cLjTEhOBEN67Okicau4S9MFseYG/VMpI LHAqVoTXO1di8RNch0m/mHnysufp9F5NGSW/XHdkW0LF2yREIZthRa7mNLLc9194mg60 Z1RRU54K0/c4kBCXNQEOKr2FcZrg9C+yEmqgwO206+Ex9r3hsfpMsPk22YwlXfvVC5ks zQVZTcxYUPuP28FYNBA039N/1D3BwT/0zrCTKQlEsounjIwWl9gvluKhYI7S/ZiS83TV d6Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=65FXJqBuVDUzxD7doK++gxysr5EY6cSmpC745+zOXJs=; b=fGoqIddHSWUwKSJYOVlMp7rpj7U57c+I1u6hfmHTi0MvgXkWYEqhvvoqHT+Hl1ivg2 /JU4cBDc+GqFzYM7vAvzTg0sPF22/4d8Se+3S+jl0xMJswPpD3uvm6MlulkZ261j+GDi fbnQnEEIj069WoQOa88IyqpsbpLCaXaYZKijhvUBUQN+D0mOhz65H3IuUyadVqOZzfzm eLWT6SUIzJ4V/Bz3LMpMzENg1kfrf3BZBLzsaANvpw/onEQYo6J3+UYS/Oa3LFg8HEob UI1i0XZwtX4uJx+4xNG3SlqBIl2hYYLpxAJ/K9E3IVYu9ja+bWHk5LeE3kKe3tnp1+Id 9zJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="Du24+tm/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si7687895ejr.667.2020.09.21.03.25.18; Mon, 21 Sep 2020 03:25:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="Du24+tm/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727196AbgIUKXN (ORCPT + 99 others); Mon, 21 Sep 2020 06:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726865AbgIUKU6 (ORCPT ); Mon, 21 Sep 2020 06:20:58 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0967BC0613D7 for ; Mon, 21 Sep 2020 03:20:54 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id j2so12126022wrx.7 for ; Mon, 21 Sep 2020 03:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=65FXJqBuVDUzxD7doK++gxysr5EY6cSmpC745+zOXJs=; b=Du24+tm/QhmhZ5IVy7r2qPHUeCurWcwjdhxfvUmy4+7fplJwd3mtGQfOB8MZgTqFl1 vbavMjLPVGU5vW1vR8Ms6EEpiDMFdTbMx6KzdLWgyGxAGWyJ9l3IJo+b51zvZfdlaWRo IgYhmvKycQsZFysfm9I7u+CkXkCTVxIy6D/955vSwybNxK5FpllxCk+uP/W68dKwvAhH t/Cv7GX9cr5h5PmH2L6acNNPIQNFtM9K0joVNuxFlS65+lOOCrjn7Ia5FfRHY7nCHeTt BT/0zrRLOTDyGVt4Wh2NawrP8Tl3/QtEXp9E9Y1Xrgx0Zm5VP3P4SCeTC7G59H/yNTtC 3F4A== 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; bh=65FXJqBuVDUzxD7doK++gxysr5EY6cSmpC745+zOXJs=; b=lUjNzNQhsG9mHkhUH23FvpRCmUYEK9XXn9GMLufVq9EPhgD05AjPevHA4ypvO7JxNW cr4Kh5ZsEibUYiKcRiluLp3EVsXhQSxy8wmz1L8uQmctWR9PzfP98miiooxs5WIdFJZ4 vJIFJfDm2jJpukvMIL0i3b8s9Ynn6gRTLbsRo51adpQ9ldmTc09m15VvZFqZuucmRNWd 53jnVtADLr2F0NX1eOrbfh+brySFq0WVynPmQYKia+/xZIEv7STMMDXi9VyGRZCrdQ/e toYSQ9hgpj54wBLBCoTmt0QheGAgoEmZFbqjWTzvS1dI+Btfuw0+Oi62w/ppoHl57VvQ 5YgA== X-Gm-Message-State: AOAM531XPKmSqBPq4YjYRXcNR/L8Mq6Lszgt3b8U7p5sTfVGJSylfNmE P7SoIbf51WOVI2+AJkgJ+2/XCw== X-Received: by 2002:a05:6000:85:: with SMTP id m5mr22915576wrx.160.1600683652749; Mon, 21 Sep 2020 03:20:52 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:51 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 21/49] staging: media: zoran: Use video_drvdata to get struct zoran Date: Mon, 21 Sep 2020 10:19:56 +0000 Message-Id: <1600683624-5863-22-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using video_drvdata() is proper and shorter than using directly fh pointers. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_driver.c | 40 ++++++++-------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 77cd2c07c394..9d39e98c9af1 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -1320,8 +1320,7 @@ static int zoran_set_input(struct zoran *zr, int input) static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); strscpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card)); strscpy(cap->driver, "zoran", sizeof(cap->driver)); @@ -1352,8 +1351,7 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag) static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_fmtdesc *f) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); return zoran_enum_fmt(zr, f, ZORAN_FORMAT_CAPTURE); } @@ -1361,8 +1359,7 @@ static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh, static int zoran_enum_fmt_vid_out(struct file *file, void *__fh, struct v4l2_fmtdesc *f) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); return zoran_enum_fmt(zr, f, ZORAN_FORMAT_PLAYBACK); } @@ -1370,8 +1367,7 @@ static int zoran_enum_fmt_vid_out(struct file *file, void *__fh, static int zoran_enum_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_fmtdesc *f) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); return zoran_enum_fmt(zr, f, ZORAN_FORMAT_OVERLAY); } @@ -1421,8 +1417,7 @@ static int zoran_g_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format static int zoran_g_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_format *fmt) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); fmt->fmt.win.w.left = zr->overlay_settings.x; fmt->fmt.win.w.top = zr->overlay_settings.y; @@ -1439,8 +1434,7 @@ static int zoran_g_fmt_vid_overlay(struct file *file, void *__fh, static int zoran_try_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_format *fmt) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); if (fmt->fmt.win.w.width > BUZ_MAX_WIDTH) fmt->fmt.win.w.width = BUZ_MAX_WIDTH; @@ -1641,8 +1635,8 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format *fmt) { + struct zoran *zr = video_drvdata(file); struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; int i; int res = 0; @@ -1689,8 +1683,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format static int zoran_g_fbuf(struct file *file, void *__fh, struct v4l2_framebuffer *fb) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); memset(fb, 0, sizeof(*fb)); fb->base = zr->vbuf_base; @@ -1709,8 +1702,8 @@ static int zoran_g_fbuf(struct file *file, void *__fh, static int zoran_s_fbuf(struct file *file, void *__fh, const struct v4l2_framebuffer *fb) { + struct zoran *zr = video_drvdata(file); struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; int i, res = 0; __le32 printformat = __cpu_to_le32(fb->fmt.pixelformat); @@ -2042,8 +2035,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); *std = zr->norm; return 0; @@ -2051,8 +2043,7 @@ static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std) static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); int res = 0; res = zoran_set_norm(zr, std); @@ -2065,8 +2056,7 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) static int zoran_enum_input(struct file *file, void *__fh, struct v4l2_input *inp) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); if (inp->index >= zr->card.inputs) return -EINVAL; @@ -2082,8 +2072,7 @@ static int zoran_enum_input(struct file *file, void *__fh, struct v4l2_input *in static int zoran_g_input(struct file *file, void *__fh, unsigned int *input) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); *input = zr->input; @@ -2092,8 +2081,7 @@ static int zoran_g_input(struct file *file, void *__fh, unsigned int *input) static int zoran_s_input(struct file *file, void *__fh, unsigned int input) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); int res; res = zoran_set_input(zr, input); -- 2.26.2