From patchwork Thu May 14 14:00:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11548765 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B92F060D for ; Thu, 14 May 2020 14:00:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95C50205CB for ; Thu, 14 May 2020 14:00:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IFvdrA87" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726037AbgENOAZ (ORCPT ); Thu, 14 May 2020 10:00:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726050AbgENOAZ (ORCPT ); Thu, 14 May 2020 10:00:25 -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 DEB7EC061A0E for ; Thu, 14 May 2020 07:00:24 -0700 (PDT) Received: from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4FEA225A; Thu, 14 May 2020 16:00:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1589464823; bh=12vttkGx0tu0fGmqwSfew32UcitF35hLFALzkHTJp4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFvdrA87OAg8O8UXd7HQlke7L/t6j5RtFaOWDlx4ijm3z1vfMrbB+coQ0XPDtq3A0 I93PPlGX8eIx5d42eIl2q9igwa2o61v/fw15cHHm1ehSVnwnARK85b0h4xnwFL4kQ1 b0vdcv8Oh7Oly/NpLwGbdB0GwXEGRhKXJ4YyZEvY= From: Kieran Bingham To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham , Laurent Pinchart , Jacopo Mondi , =?utf-8?q?Niklas_S=C3=B6derlund?= , Hyun Kwon , Manivannan Sadhasivam , Kieran Bingham Subject: [PATCH v9.1 1/3] fixes! [max9286]: Use the same default mbus_fmt everywhere Date: Thu, 14 May 2020 15:00:14 +0100 Message-Id: <20200514140016.1445489-2-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514140016.1445489-1-kieran.bingham+renesas@ideasonboard.com> References: <20200514140016.1445489-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The default code used in max9286_set_fmt() differs from other defaults. Correct it. Reported-by: Manivannan Sadhasivam Signed-off-by: Kieran Bingham --- drivers/media/i2c/max9286.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 481d65f2b51d..c8ca1245df4b 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -722,7 +722,7 @@ static int max9286_set_fmt(struct v4l2_subdev *sd, case MEDIA_BUS_FMT_YVYU8_2X8: break; default: - format->format.code = MEDIA_BUS_FMT_YUYV8_2X8; + format->format.code = MEDIA_BUS_FMT_UYVY8_2X8; break; } From patchwork Thu May 14 14:00:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11548767 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50FE81391 for ; Thu, 14 May 2020 14:00:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35D43205CB for ; Thu, 14 May 2020 14:00:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BBTfZht5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726117AbgENOA0 (ORCPT ); Thu, 14 May 2020 10:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726050AbgENOA0 (ORCPT ); Thu, 14 May 2020 10:00:26 -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 65918C061A0C for ; Thu, 14 May 2020 07:00:26 -0700 (PDT) Received: from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CBC7D26A; Thu, 14 May 2020 16:00:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1589464824; bh=GPjMv3EGxJluU7KycetZHfc1l6xd1LqgNg93yApJawQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBTfZht51LGiuEI+hh1bQ/K5ooDwgSL9q5GSwInEqc1wpXSjvelrVkaWcaP8S4wJg PLAINWVzEQ1nOTYgfgyGSi+Fijqct5jK0a7aVD/j+Zh4B4al0YJveaU/1M4FA//1Mf qaOPAsLskekANE0pPQ6NXSzcApqWaV8+w+dxsGwA= From: Kieran Bingham To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham , Laurent Pinchart , Jacopo Mondi , =?utf-8?q?Niklas_S=C3=B6derlund?= , Hyun Kwon , Manivannan Sadhasivam , Kieran Bingham Subject: [PATCH v9 2/3] fixes! [max9286]: Don't provide GPIO names Date: Thu, 14 May 2020 15:00:15 +0100 Message-Id: <20200514140016.1445489-3-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514140016.1445489-1-kieran.bingham+renesas@ideasonboard.com> References: <20200514140016.1445489-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The GPIO line names are fairly unhelpful, other than describing them as out lines only ... but otherwise ... Having multiple gpio devices with the same names reports conflicts. so lets just remove them. Signed-off-by: Kieran Bingham --- drivers/media/i2c/max9286.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index c8ca1245df4b..66201dc4b7f7 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -1019,11 +1019,6 @@ static int max9286_register_gpio(struct max9286_priv *priv) struct gpio_chip *gpio = &priv->gpio; int ret; - static const char * const names[] = { - "GPIO0OUT", - "GPIO1OUT", - }; - /* Configure the GPIO */ gpio->label = dev_name(dev); gpio->parent = dev; @@ -1034,7 +1029,6 @@ static int max9286_register_gpio(struct max9286_priv *priv) gpio->set = max9286_gpio_set; gpio->get = max9286_gpio_get; gpio->can_sleep = true; - gpio->names = names; /* GPIO values default to high */ priv->gpio_state = BIT(0) | BIT(1); From patchwork Thu May 14 14:00:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11548769 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A46A4139A for ; Thu, 14 May 2020 14:00:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 870CD205CB for ; Thu, 14 May 2020 14:00:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NwU18eA8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726140AbgENOA1 (ORCPT ); Thu, 14 May 2020 10:00:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726050AbgENOA1 (ORCPT ); Thu, 14 May 2020 10:00:27 -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 0BD4EC061A0C for ; Thu, 14 May 2020 07:00:27 -0700 (PDT) Received: from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 58908259; Thu, 14 May 2020 16:00:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1589464825; bh=J3ZQfYkcJE46bE8ljP/9BLvQwPr3k/lXc0GkEtRRRHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NwU18eA8/kvePBpRfrSMYPgrLTK/wujClbD7UQIqevXnzQtu+1IYF0sE17TLuACaU hpGjy8LhxeDMrsa2gILRN6WGXYKLX4PZLT3xm94/d1EhS1tg6gyLQrRou0zMeQWDJJ Kho3WITRr1UZ/+/PvccOw6jZhppVvhlI6Db2H4Y4= From: Kieran Bingham To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham , Laurent Pinchart , Jacopo Mondi , =?utf-8?q?Niklas_S=C3=B6derlund?= , Hyun Kwon , Manivannan Sadhasivam , Kieran Bingham Subject: [PATCH v9 3/3] fixes! [max9286]: Fix dev->of_node refcnting Date: Thu, 14 May 2020 15:00:16 +0100 Message-Id: <20200514140016.1445489-4-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514140016.1445489-1-kieran.bingham+renesas@ideasonboard.com> References: <20200514140016.1445489-1-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org With a little help from an of_ref_read(): +static int of_ref_read(struct device_node *node) +{ + if (node) + return kref_read(&node->kobj.kref); + + return 0; +} I've validated the refcount of the node now stays consitent. Particularly between entry (A) and exit (B) of the parse_dt function: [ 2.305784] max9286 4-004c: A: node refcnt is 6 [ 2.310401] max9286 4-004c: node refcnt is 6 [ 2.314729] max9286 4-004c: 1335: node refcnt is 6 [ 2.319587] max9286 4-004c: 1356: node refcnt is 6 [ 2.324432] max9286 4-004c: 1364: (in for_each) node refcnt is 6 [ 2.330503] max9286 4-004c: 1364: (in for_each) node refcnt is 6 [ 2.336575] max9286 4-004c: 1364: (in for_each) node refcnt is 6 [ 2.342656] max9286 4-004c: 1364: (in for_each) node refcnt is 6 [ 2.348724] max9286 4-004c: 1364: (in for_each) node refcnt is 6 [ 2.354808] max9286 4-004c: 1437: node refcnt is 6 [ 2.359644] max9286 4-004c: B: node refcnt is 6 I've added a comment to explain the extra of_node_get() but the exercise identified that the driver was incorrectly calling of_node_put() on the same node. Those have been removed. Signed-off-by: Kieran Bingham --- drivers/media/i2c/max9286.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 66201dc4b7f7..590f384161a5 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -1108,11 +1108,11 @@ static int max9286_parse_dt(struct max9286_priv *priv) struct device_node *node = NULL; unsigned int i2c_mux_mask = 0; + /* Balance the of_node_put() performed by of_find_node_by_name(). */ of_node_get(dev->of_node); i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux"); if (!i2c_mux) { dev_err(dev, "Failed to find i2c-mux node\n"); - of_node_put(dev->of_node); return -EINVAL; } @@ -1160,7 +1160,6 @@ static int max9286_parse_dt(struct max9286_priv *priv) of_fwnode_handle(node), &vep); if (ret) { of_node_put(node); - of_node_put(dev->of_node); return ret; } @@ -1170,7 +1169,6 @@ static int max9286_parse_dt(struct max9286_priv *priv) vep.bus_type); v4l2_fwnode_endpoint_free(&vep); of_node_put(node); - of_node_put(dev->of_node); return -EINVAL; } @@ -1208,7 +1206,6 @@ static int max9286_parse_dt(struct max9286_priv *priv) priv->nsources++; } of_node_put(node); - of_node_put(dev->of_node); priv->route_mask = priv->source_mask;