From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Quadros Subject: Re: [PATCH 1/2] extcon: fix hang and extcon_get/set_cable_state(). Date: Tue, 7 Jul 2015 15:58:43 +0300 Message-ID: <559BCD03.30103@ti.com> References: <1436194018-18696-1-git-send-email-rogerq@ti.com> <1436194018-18696-2-git-send-email-rogerq@ti.com> <1436272845.2190.3.camel@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436272845.2190.3.camel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org To: "Ivan T. Ivanov" Cc: cw00.choi@samsung.com, linux-omap@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman List-Id: linux-omap@vger.kernel.org Hi, On 07/07/15 15:40, Ivan T. Ivanov wrote: > > On Mon, 2015-07-06 at 17:46 +0300, Roger Quadros wrote: > >> >> -static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) >> +static int find_cable_id_by_name(struct extcon_dev *edev, const char *name) >> { >> - unsigned int id = EXTCON_NONE; >> + unsigned int id = -EINVAL; >> int i = 0; >> >> - if (edev->max_supported == 0) >> - return -EINVAL; >> - >> - /* Find the the number of extcon cable */ >> + /* Find the id of extcon cable */ >> while (extcon_name[i]) { >> if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) { >> id = i; >> @@ -140,6 +137,19 @@ static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) >> } >> } >> > > Thank you Roger, but this still hang. 'i' is not incremented. You are right. Thanks for pointing out. I will send out a v2. > > Ivan > >> + return id; >> +}; >> cheers, -roger From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757366AbbGGM7F (ORCPT ); Tue, 7 Jul 2015 08:59:05 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:58215 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757194AbbGGM6v (ORCPT ); Tue, 7 Jul 2015 08:58:51 -0400 Message-ID: <559BCD03.30103@ti.com> Date: Tue, 7 Jul 2015 15:58:43 +0300 From: Roger Quadros User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Ivan T. Ivanov" CC: , , , , Greg Kroah-Hartman Subject: Re: [PATCH 1/2] extcon: fix hang and extcon_get/set_cable_state(). References: <1436194018-18696-1-git-send-email-rogerq@ti.com> <1436194018-18696-2-git-send-email-rogerq@ti.com> <1436272845.2190.3.camel@linaro.org> In-Reply-To: <1436272845.2190.3.camel@linaro.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 07/07/15 15:40, Ivan T. Ivanov wrote: > > On Mon, 2015-07-06 at 17:46 +0300, Roger Quadros wrote: > >> >> -static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) >> +static int find_cable_id_by_name(struct extcon_dev *edev, const char *name) >> { >> - unsigned int id = EXTCON_NONE; >> + unsigned int id = -EINVAL; >> int i = 0; >> >> - if (edev->max_supported == 0) >> - return -EINVAL; >> - >> - /* Find the the number of extcon cable */ >> + /* Find the id of extcon cable */ >> while (extcon_name[i]) { >> if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) { >> id = i; >> @@ -140,6 +137,19 @@ static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) >> } >> } >> > > Thank you Roger, but this still hang. 'i' is not incremented. You are right. Thanks for pointing out. I will send out a v2. > > Ivan > >> + return id; >> +}; >> cheers, -roger