From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751347AbdALKza (ORCPT ); Thu, 12 Jan 2017 05:55:30 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:58047 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750815AbdALKzY (ORCPT ); Thu, 12 Jan 2017 05:55:24 -0500 Message-ID: <1484218448.2376.11.camel@pengutronix.de> Subject: Re: [PATCH v2 2/2] reset: make optional functions really optional From: Philipp Zabel To: Ramiro Oliveira Cc: linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com, CARLOS.PALMINHA@synopsys.com Date: Thu, 12 Jan 2017 11:54:08 +0100 In-Reply-To: <88f890ef-b16e-a558-3c2f-cfeba107b578@synopsys.com> References: <1483958747.13625.11.camel@pengutronix.de> <88f890ef-b16e-a558-3c2f-cfeba107b578@synopsys.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ramiro, Am Montag, den 09.01.2017, 17:19 +0000 schrieb Ramiro Oliveira: > Hi Philipp > > On 1/9/2017 10:45 AM, Philipp Zabel wrote: > > Hi Ramiro, > > > > Am Dienstag, den 27.12.2016, 12:37 +0000 schrieb Ramiro Oliveira: > >> The optional functions weren't really optional so this patch makes them > >> really optional. > > > > Please add a bit of detail to the description. Since this changes the > > API, you should mention that the reset_control_get_optional variants now > > return NULL instead of an error if there is no matching reset phandle in > > the device tree and that the reset_control_* functions accept NULL rstc > > pointers. > > > > Would you be ok with something like this: > > "The *_get_optional_* functions weren't really optional so this patch makes them > really optional. > > These *_get_optional_* functions will now return NULL instead of an error if no > matching reset phandle is found in the DT, and all the reset_control_* functions > now accept NULL rstc pointers Yes, that looks fine to me. [...] > >> @@ -273,13 +295,13 @@ struct reset_control *__of_reset_control_get(struct device_node *node, > >> index = of_property_match_string(node, > >> "reset-names", id); > >> if (index < 0) > >> - return ERR_PTR(-ENOENT); > >> + return optional ? NULL : ERR_PTR(-ENOENT); > > > > of_property_match_string can return -EINVAL, -ENODATA, or -EILSEQ. > > I think -EILSEQ should still be returned. > > > > I'll make the function return NULL, -ENOENT, or -EILSEQ. Ok. > >> } > >> > >> ret = of_parse_phandle_with_args(node, "resets", "#reset-cells", > >> index, &args); > >> if (ret) > >> - return ERR_PTR(ret); > >> + return optional ? NULL : ERR_PTR(ret); > > > > of_parse_phandle_with_args can return -ENOENT or -EINVAL. > > I think -EINVAL should still be returned. > > > > Same as above. I'll make the function return NULL, -ENOENT, or -EINVAL. thanks Philipp