linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 linux-next] usb:typec:mux: remove indentation for common path
@ 2024-04-24 17:27 sundar
  2024-04-25 10:10 ` Heikki Krogerus
  0 siblings, 1 reply; 5+ messages in thread
From: sundar @ 2024-04-24 17:27 UTC (permalink / raw)
  To: heikki.krogerus, gregkh, neil.armstrong, dmitry.baryshkov,
	u.kleine-koenig, christophe.jaillet
  Cc: linux-usb, linux-kernel, skhan, javier.carrasco.cruz, sundar

Nitpick, Mostly common path will not be indented.  so rewritten this 
function to check device_node pointer is null and removed common path 
indentation.

Signed-off-by: sundar <prosunofficial@gmail.com>
---
Fixed nitpicks in code according to comments received on other patch as
below:

[ Nit, this function should be rewritten to not work like this, the
"common" path should not be indented, but only the exception (i.e. bail
if ep is not allocated properly.) ]
https://lore.kernel.org/all/2024041103-doornail-professor-7c1e@gregkh/

Goal is to get rid of of_node_put,but sending this patch first to do one
thing at a time.

Changes since v1 - fixed the typo error for spell from identation to
indentation

Changes since v2 - Shifted the indentation to one level left for the
switch cases as per coding style.

Changes since v3 - Added descriptive subject for the patch and checked
from and sign-off having same name.

Patches link:
------------
v1  - https://lore.kernel.org/all/20240420145522.15018-1-prosunofficial@gmail.com/
v2  - https://lore.kernel.org/linux-usb/20240420164927.15290-1-prosunofficial@gmail.com/
v3  - https://lore.kernel.org/all/20240421011647.3027-1-prosunofficial@gmail.com/


 drivers/usb/typec/mux/nb7vpq904m.c | 68 +++++++++++++++---------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c
index b17826713753..f7a00b388876 100644
--- a/drivers/usb/typec/mux/nb7vpq904m.c
+++ b/drivers/usb/typec/mux/nb7vpq904m.c
@@ -320,47 +320,47 @@ static int nb7vpq904m_parse_data_lanes_mapping(struct nb7vpq904m *nb7)
 	int ret, i, j;
 
 	ep = of_graph_get_endpoint_by_regs(nb7->client->dev.of_node, 1, 0);
+	if (!ep)
+		return 0;
 
-	if (ep) {
-		ret = of_property_count_u32_elems(ep, "data-lanes");
-		if (ret == -EINVAL)
-			/* Property isn't here, consider default mapping */
-			goto out_done;
-		if (ret < 0)
-			goto out_error;
-
-		if (ret != DATA_LANES_COUNT) {
-			dev_err(&nb7->client->dev, "expected 4 data lanes\n");
-			ret = -EINVAL;
-			goto out_error;
-		}
-
-		ret = of_property_read_u32_array(ep, "data-lanes", data_lanes, DATA_LANES_COUNT);
-		if (ret)
-			goto out_error;
+	ret = of_property_count_u32_elems(ep, "data-lanes");
+	if (ret == -EINVAL)
+		/* Property isn't here, consider default mapping */
+		goto out_done;
+	if (ret < 0)
+		goto out_error;
+
+	if (ret != DATA_LANES_COUNT) {
+		dev_err(&nb7->client->dev, "expected 4 data lanes\n");
+		ret = -EINVAL;
+		goto out_error;
+	}
 
-		for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) {
-			for (j = 0; j < DATA_LANES_COUNT; j++) {
-				if (data_lanes[j] != supported_data_lane_mapping[i][j])
-					break;
-			}
+	ret = of_property_read_u32_array(ep, "data-lanes", data_lanes, DATA_LANES_COUNT);
+	if (ret)
+		goto out_error;
 
-			if (j == DATA_LANES_COUNT)
+	for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) {
+		for (j = 0; j < DATA_LANES_COUNT; j++) {
+			if (data_lanes[j] != supported_data_lane_mapping[i][j])
 				break;
 		}
 
-		switch (i) {
-		case NORMAL_LANE_MAPPING:
-			break;
-		case INVERT_LANE_MAPPING:
-			nb7->swap_data_lanes = true;
-			dev_info(&nb7->client->dev, "using inverted data lanes mapping\n");
+		if (j == DATA_LANES_COUNT)
 			break;
-		default:
-			dev_err(&nb7->client->dev, "invalid data lanes mapping\n");
-			ret = -EINVAL;
-			goto out_error;
-		}
+	}
+
+	switch (i) {
+	case NORMAL_LANE_MAPPING:
+		break;
+	case INVERT_LANE_MAPPING:
+		nb7->swap_data_lanes = true;
+		dev_info(&nb7->client->dev, "using inverted data lanes mapping\n");
+		break;
+	default:
+		dev_err(&nb7->client->dev, "invalid data lanes mapping\n");
+		ret = -EINVAL;
+		goto out_error;
 	}
 
 out_done:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 linux-next] usb:typec:mux: remove indentation for common path
  2024-04-24 17:27 [PATCH v4 linux-next] usb:typec:mux: remove indentation for common path sundar
@ 2024-04-25 10:10 ` Heikki Krogerus
  2024-04-25 14:45   ` sundar
  0 siblings, 1 reply; 5+ messages in thread
From: Heikki Krogerus @ 2024-04-25 10:10 UTC (permalink / raw)
  To: sundar
  Cc: gregkh, neil.armstrong, dmitry.baryshkov, u.kleine-koenig,
	christophe.jaillet, linux-usb, linux-kernel, skhan,
	javier.carrasco.cruz

On Wed, Apr 24, 2024 at 10:57:16PM +0530, sundar wrote:
> Nitpick, Mostly common path will not be indented.  so rewritten this 
> function to check device_node pointer is null and removed common path 
> indentation.
> 
> Signed-off-by: sundar <prosunofficial@gmail.com>

I don't think that is your full name, or is it?

thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 linux-next] usb:typec:mux: remove indentation for common path
  2024-04-25 10:10 ` Heikki Krogerus
@ 2024-04-25 14:45   ` sundar
  2024-04-26 12:57     ` Heikki Krogerus
  0 siblings, 1 reply; 5+ messages in thread
From: sundar @ 2024-04-25 14:45 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: gregkh, neil.armstrong, dmitry.baryshkov, u.kleine-koenig,
	christophe.jaillet, linux-usb, linux-kernel, skhan,
	javier.carrasco.cruz

On 25/04/24 15:40, Heikki Krogerus wrote:
> On Wed, Apr 24, 2024 at 10:57:16PM +0530, sundar wrote:
>> Nitpick, Mostly common path will not be indented.  so rewritten this
>> function to check device_node pointer is null and removed common path
>> indentation.
>>
>> Signed-off-by: sundar <prosunofficial@gmail.com>
> 
> I don't think that is your full name, or is it?
> 
> thanks,
> 
Hi Heikki,

Sundar is my full name.
Previously, I wrote my name in caps.after changing to small,  conflict 
arises.now I fixed it.

Thanks,
Sundar

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 linux-next] usb:typec:mux: remove indentation for common path
  2024-04-25 14:45   ` sundar
@ 2024-04-26 12:57     ` Heikki Krogerus
  2024-04-26 14:47       ` sundar
  0 siblings, 1 reply; 5+ messages in thread
From: Heikki Krogerus @ 2024-04-26 12:57 UTC (permalink / raw)
  To: sundar
  Cc: gregkh, neil.armstrong, dmitry.baryshkov, u.kleine-koenig,
	christophe.jaillet, linux-usb, linux-kernel, skhan,
	javier.carrasco.cruz

On Thu, Apr 25, 2024 at 08:15:04PM +0530, sundar wrote:
> On 25/04/24 15:40, Heikki Krogerus wrote:
> > On Wed, Apr 24, 2024 at 10:57:16PM +0530, sundar wrote:
> > > Nitpick, Mostly common path will not be indented.  so rewritten this
> > > function to check device_node pointer is null and removed common path
> > > indentation.
> > > 
> > > Signed-off-by: sundar <prosunofficial@gmail.com>
> > 
> > I don't think that is your full name, or is it?
> > 
> > thanks,
> > 
> Hi Heikki,
> 
> Sundar is my full name.
> Previously, I wrote my name in caps.after changing to small,  conflict
> arises.now I fixed it.


You need to use your real, full name - what ever your name is in your
passport. I find it a bit hard to believe you don't have a family (or
given?) name.

Your email returns couple of commits where you're name is "R SUNDAR".
What does the "R" stand for?

thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4 linux-next] usb:typec:mux: remove indentation for common path
  2024-04-26 12:57     ` Heikki Krogerus
@ 2024-04-26 14:47       ` sundar
  0 siblings, 0 replies; 5+ messages in thread
From: sundar @ 2024-04-26 14:47 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: gregkh, neil.armstrong, dmitry.baryshkov, u.kleine-koenig,
	christophe.jaillet, linux-usb, linux-kernel, skhan,
	javier.carrasco.cruz

On 26/04/24 18:27, Heikki Krogerus wrote:
> On Thu, Apr 25, 2024 at 08:15:04PM +0530, sundar wrote:
>> On 25/04/24 15:40, Heikki Krogerus wrote:
>>> On Wed, Apr 24, 2024 at 10:57:16PM +0530, sundar wrote:
>>>> Nitpick, Mostly common path will not be indented.  so rewritten this
>>>> function to check device_node pointer is null and removed common path
>>>> indentation.
>>>>
>>>> Signed-off-by: sundar <prosunofficial@gmail.com>
>>>
>>> I don't think that is your full name, or is it?
>>>
>>> thanks,
>>>
>> Hi Heikki,
>>
>> Sundar is my full name.
>> Previously, I wrote my name in caps.after changing to small,  conflict
>> arises.now I fixed it.
> 
> 
> You need to use your real, full name - what ever your name is in your
> passport. I find it a bit hard to believe you don't have a family (or
> given?) name.
> 
> Your email returns couple of commits where you're name is "R SUNDAR".
> What does the "R" stand for?
> 
> thanks,
> 
Hi Heikki,

ok, so it will be R Sundar. I will change and send updated patch.
R is first letter of father's name.

sorry for inconvenience.

Regards,
Sundar.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-26 14:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 17:27 [PATCH v4 linux-next] usb:typec:mux: remove indentation for common path sundar
2024-04-25 10:10 ` Heikki Krogerus
2024-04-25 14:45   ` sundar
2024-04-26 12:57     ` Heikki Krogerus
2024-04-26 14:47       ` sundar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).