Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3389061pxf; Mon, 15 Mar 2021 08:31:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6Da9Tymfa+3i+2aX5Uk50NF3CgSfQdYJYSvA75vgAzJrOE0QCciK5r6xhwsf2sLah9ttc X-Received: by 2002:a17:906:2314:: with SMTP id l20mr24740432eja.178.1615822264621; Mon, 15 Mar 2021 08:31:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615822264; cv=none; d=google.com; s=arc-20160816; b=GmfwwMNEWcu7g94sg7wXWjiOXlXAAjiCH8/EQSX2g2q4LC7fv8eG1vVjxE0kRrVR9z n1VJCfsx5KN7sRFCHQ16/DYmR63H1pAEfgucW5+2w5rn/rEdnQCZ1f8dmwt0UnwBxCKj 11u7sQDOLJIaf65/cxmUB2wdqNCNEiQZJfAGE3mRlbru4vzCTHYL36Rv312tNt7Vl1di t5HbmNBKO3p8Pnc1EiAe+aSa32r7pzst0QtJydWpsF0REtOfunSmGEa5OtppkynKQHSL VL/dxPUej3Qfd4HVt03WKcvrG9rCR16WPPyepexo7lUFPq0c/25cKWUDupKO3znmrLOh 7VEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:reply-to:dkim-signature; bh=76Yh/kx/IRzOdC8qOJfsyF+sQpJR+MC78N/s61f9gIo=; b=J8E/DqipSM9FHEMDiR6RGWihX/TqVsmxx2WtQRqfyTMtx/3QzAjxXbJkcq3OfpT2hd amNFzvNCCmfD53wP5CmUBGhAx293Q5VFBB9mUDO4TvVz5xN4z0qmGv3IKrFsaVIMWXRF rSrc5fHJFeDoO8LQs7YbUFhUDkUwQAk3LTegmd31M14QMYMLAgywwfEfb33gtAi8uXvp 6aiJX8F27L8+uUnTSvpV8Rd15aq10B2HjWTBaKuGnwUcDEcDOjYcit85xWqfVi7/b9TY IkAhXRGpRB/R6CvPN2/bW6q1GsObleMzl2h1ERU0hNu35u56Dyc2zp8fNr6zWKuBh6bo nazw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=g47MtynH; 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 z14si11571461edq.36.2021.03.15.08.30.40; Mon, 15 Mar 2021 08:31:04 -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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=g47MtynH; 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 S230428AbhCOP3g (ORCPT + 99 others); Mon, 15 Mar 2021 11:29:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbhCOP3E (ORCPT ); Mon, 15 Mar 2021 11:29:04 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796AFC06174A; Mon, 15 Mar 2021 08:29:04 -0700 (PDT) Received: from [192.168.0.20] (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E0D09556; Mon, 15 Mar 2021 16:29:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615822143; bh=JftYtn6eS1Bel0BSeL+IPZ40USl4otVnwyv2aWIzRjg=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=g47MtynHxRaXz3KADyU5UVBtdcwdYVwaVb9htbQQI2zCLSGYahJ4k/KXH3Gn8rcVE J9CGMfjM+mN81pTd6V011gPaWzmjeS7/mOXyLLRW1MGSMpUcYDbALTnX7rM5ywRJaq Jy7dCe+er6Bt1/IyN50QW6cR3ItPA+KMFrwMlsGU= Reply-To: kieran.bingham+renesas@ideasonboard.com Subject: Re: [PATCH v2 03/18] media: i2c: rdacm20: Embedded 'serializer' field To: Jacopo Mondi , laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Laurent Pinchart References: <20210315131512.133720-1-jacopo+renesas@jmondi.org> <20210315131512.133720-4-jacopo+renesas@jmondi.org> From: Kieran Bingham Organization: Ideas on Board Message-ID: <51366161-1cec-f9be-7774-5bd2ef320d85@ideasonboard.com> Date: Mon, 15 Mar 2021 15:29:00 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210315131512.133720-4-jacopo+renesas@jmondi.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacopo, in $SUBJECT s/Embedded/Embed/ But it's trivial so no worries unless there's another iteration. On 15/03/2021 13:14, Jacopo Mondi wrote: > There's no reason to allocate dynamically the 'serializer' field in > the driver structure. > > Embed the field and adjust all its users in the driver. > > Reviewed-by: Kieran Bingham Still holds ;-) > Reviewed-by: Laurent Pinchart > Signed-off-by: Jacopo Mondi > --- > drivers/media/i2c/rdacm20.c | 38 ++++++++++++++++--------------------- > 1 file changed, 16 insertions(+), 22 deletions(-) > > diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c > index f7fd5ae955d0..4d9bac87cba8 100644 > --- a/drivers/media/i2c/rdacm20.c > +++ b/drivers/media/i2c/rdacm20.c > @@ -312,7 +312,7 @@ static const struct ov10635_reg { > > struct rdacm20_device { > struct device *dev; > - struct max9271_device *serializer; > + struct max9271_device serializer; > struct i2c_client *sensor; > struct v4l2_subdev sd; > struct media_pad pad; > @@ -399,7 +399,7 @@ static int rdacm20_s_stream(struct v4l2_subdev *sd, int enable) > { > struct rdacm20_device *dev = sd_to_rdacm20(sd); > > - return max9271_set_serial_link(dev->serializer, enable); > + return max9271_set_serial_link(&dev->serializer, enable); > } > > static int rdacm20_enum_mbus_code(struct v4l2_subdev *sd, > @@ -456,11 +456,11 @@ static int rdacm20_initialize(struct rdacm20_device *dev) > int ret; > > /* Verify communication with the MAX9271: ping to wakeup. */ > - dev->serializer->client->addr = MAX9271_DEFAULT_ADDR; > - i2c_smbus_read_byte(dev->serializer->client); > + dev->serializer.client->addr = MAX9271_DEFAULT_ADDR; > + i2c_smbus_read_byte(dev->serializer.client); > > /* Serial link disabled during config as it needs a valid pixel clock. */ > - ret = max9271_set_serial_link(dev->serializer, false); > + ret = max9271_set_serial_link(&dev->serializer, false); > if (ret) > return ret; > > @@ -468,35 +468,35 @@ static int rdacm20_initialize(struct rdacm20_device *dev) > * Ensure that we have a good link configuration before attempting to > * identify the device. > */ > - max9271_configure_i2c(dev->serializer, MAX9271_I2CSLVSH_469NS_234NS | > - MAX9271_I2CSLVTO_1024US | > - MAX9271_I2CMSTBT_105KBPS); > + max9271_configure_i2c(&dev->serializer, MAX9271_I2CSLVSH_469NS_234NS | > + MAX9271_I2CSLVTO_1024US | > + MAX9271_I2CMSTBT_105KBPS); > > - max9271_configure_gmsl_link(dev->serializer); > + max9271_configure_gmsl_link(&dev->serializer); > > - ret = max9271_verify_id(dev->serializer); > + ret = max9271_verify_id(&dev->serializer); > if (ret < 0) > return ret; > > - ret = max9271_set_address(dev->serializer, dev->addrs[0]); > + ret = max9271_set_address(&dev->serializer, dev->addrs[0]); > if (ret < 0) > return ret; > - dev->serializer->client->addr = dev->addrs[0]; > + dev->serializer.client->addr = dev->addrs[0]; > > /* > * Reset the sensor by cycling the OV10635 reset signal connected to the > * MAX9271 GPIO1 and verify communication with the OV10635. > */ > - ret = max9271_enable_gpios(dev->serializer, MAX9271_GPIO1OUT); > + ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT); > if (ret) > return ret; > > - ret = max9271_clear_gpios(dev->serializer, MAX9271_GPIO1OUT); > + ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT); > if (ret) > return ret; > usleep_range(10000, 15000); > > - ret = max9271_set_gpios(dev->serializer, MAX9271_GPIO1OUT); > + ret = max9271_set_gpios(&dev->serializer, MAX9271_GPIO1OUT); > if (ret) > return ret; > usleep_range(10000, 15000); > @@ -560,13 +560,7 @@ static int rdacm20_probe(struct i2c_client *client) > if (!dev) > return -ENOMEM; > dev->dev = &client->dev; > - > - dev->serializer = devm_kzalloc(&client->dev, sizeof(*dev->serializer), > - GFP_KERNEL); > - if (!dev->serializer) > - return -ENOMEM; > - > - dev->serializer->client = client; > + dev->serializer.client = client; > > ret = of_property_read_u32_array(client->dev.of_node, "reg", > dev->addrs, 2); >