From patchwork Wed Sep 17 19:00:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 4926141 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 11C6ABEEA5 for ; Wed, 17 Sep 2014 19:02:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D170820154 for ; Wed, 17 Sep 2014 19:02:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD659200DC for ; Wed, 17 Sep 2014 19:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756050AbaIQTCl (ORCPT ); Wed, 17 Sep 2014 15:02:41 -0400 Received: from mailrelay005.isp.belgacom.be ([195.238.6.171]:5946 "EHLO mailrelay005.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756351AbaIQTAy (ORCPT ); Wed, 17 Sep 2014 15:00:54 -0400 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtgNAL/ZGVRXQCIg/2dsb2JhbABhgw22FQUBcAGbFwGBFhcBeYQEAQUnLyMQUTkeGYhCAb9nGIYJiW4HFoQ1BZ0MjDKJFoIbgUU7L4JKAQEB Received: from 32.34-64-87.adsl-dyn.isp.belgacom.be (HELO linux-zvq9.site) ([87.64.34.32]) by relay.skynet.be with ESMTP; 17 Sep 2014 21:00:53 +0200 From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: daniel.vetter@intel.com, Fabian Frederick , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org Subject: [PATCH 3/6] video: fbdev: controlfb.c: use container_of to resolve fb_info_control from fb_info Date: Wed, 17 Sep 2014 21:00:16 +0200 Message-Id: <1410980419-5326-4-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1410980419-5326-1-git-send-email-fabf@skynet.be> References: <1410980419-5326-1-git-send-email-fabf@skynet.be> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick --- PPC32 cross-compiled but untested. drivers/video/fbdev/controlfb.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index fdadef9..080fdd2 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -218,7 +218,8 @@ static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *i */ static int controlfb_set_par (struct fb_info *info) { - struct fb_info_control *p = (struct fb_info_control *) info; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); struct fb_par_control par; int err; @@ -258,7 +259,8 @@ static int controlfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) { unsigned int xoffset, hstep; - struct fb_info_control *p = (struct fb_info_control *)info; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); struct fb_par_control *par = &p->par; /* @@ -309,7 +311,8 @@ static int controlfb_mmap(struct fb_info *info, static int controlfb_blank(int blank_mode, struct fb_info *info) { - struct fb_info_control *p = (struct fb_info_control *) info; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); unsigned ctrl; ctrl = ld_le32(CNTRL_REG(p,ctrl)); @@ -342,7 +345,8 @@ static int controlfb_blank(int blank_mode, struct fb_info *info) static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) { - struct fb_info_control *p = (struct fb_info_control *) info; + struct fb_info_control *p = + container_of(info, struct fb_info_control, info); __u8 r, g, b; if (regno > 255) @@ -833,7 +837,8 @@ static int control_var_to_par(struct fb_var_screeninfo *var, unsigned hperiod, hssync, hsblank, hesync, heblank, piped, heq, hlfln, hserr, vperiod, vssync, vesync, veblank, vsblank, vswin, vewin; unsigned long pixclock; - struct fb_info_control *p = (struct fb_info_control *) fb_info; + struct fb_info_control *p = + container_of(fb_info, struct fb_info_control, info); struct control_regvals *r = &par->regvals; switch (var->bits_per_pixel) {