* [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
@ 2021-04-07 9:15 Zhen Lei
2021-04-08 8:28 ` Heikki Krogerus
2021-04-08 9:10 ` Hans de Goede
0 siblings, 2 replies; 11+ messages in thread
From: Zhen Lei @ 2021-04-07 9:15 UTC (permalink / raw)
To: Guenter Roeck, Heikki Krogerus, Greg Kroah-Hartman, linux-usb,
linux-kernel
Cc: Zhen Lei, Hans de Goede
Fixes the following W=1 kernel build warning:
drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
The reference to the variable 'tcpm_altmode_ops' is deleted by the
commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
mechanism").
By the way, the static functions referenced only by the variable
'tcpm_altmode_ops' are deleted accordingly.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/usb/typec/tcpm/tcpm.c | 60 -------------------------------------------
1 file changed, 60 deletions(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index ce7af398c7c1c1f..2f89bae29c0c297 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -1365,14 +1365,6 @@ static void tcpm_queue_vdm(struct tcpm_port *port, const u32 header,
mod_vdm_delayed_work(port, 0);
}
-static void tcpm_queue_vdm_unlocked(struct tcpm_port *port, const u32 header,
- const u32 *data, int cnt)
-{
- mutex_lock(&port->lock);
- tcpm_queue_vdm(port, header, data, cnt);
- mutex_unlock(&port->lock);
-}
-
static void svdm_consume_identity(struct tcpm_port *port, const u32 *p, int cnt)
{
u32 vdo = p[VDO_INDEX_IDH];
@@ -1705,8 +1697,6 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
*
* And we also have this ordering:
* 1. alt-mode driver takes the alt-mode's lock
- * 2. alt-mode driver calls tcpm_altmode_enter which takes the
- * tcpm port lock
*
* Dropping our lock here avoids this.
*/
@@ -2060,56 +2050,6 @@ static int tcpm_validate_caps(struct tcpm_port *port, const u32 *pdo,
return 0;
}
-static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
-{
- struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
- int svdm_version;
- u32 header;
-
- svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
- if (svdm_version < 0)
- return svdm_version;
-
- header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
- header |= VDO_OPOS(altmode->mode);
-
- tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0);
- return 0;
-}
-
-static int tcpm_altmode_exit(struct typec_altmode *altmode)
-{
- struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
- int svdm_version;
- u32 header;
-
- svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
- if (svdm_version < 0)
- return svdm_version;
-
- header = VDO(altmode->svid, 1, svdm_version, CMD_EXIT_MODE);
- header |= VDO_OPOS(altmode->mode);
-
- tcpm_queue_vdm_unlocked(port, header, NULL, 0);
- return 0;
-}
-
-static int tcpm_altmode_vdm(struct typec_altmode *altmode,
- u32 header, const u32 *data, int count)
-{
- struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
-
- tcpm_queue_vdm_unlocked(port, header, data, count - 1);
-
- return 0;
-}
-
-static const struct typec_altmode_ops tcpm_altmode_ops = {
- .enter = tcpm_altmode_enter,
- .exit = tcpm_altmode_exit,
- .vdm = tcpm_altmode_vdm,
-};
-
/*
* PD (data, control) command handling functions
*/
--
1.8.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-07 9:15 [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops' Zhen Lei
@ 2021-04-08 8:28 ` Heikki Krogerus
2021-04-08 8:38 ` Greg Kroah-Hartman
2021-04-08 13:55 ` Guenter Roeck
2021-04-08 9:10 ` Hans de Goede
1 sibling, 2 replies; 11+ messages in thread
From: Heikki Krogerus @ 2021-04-08 8:28 UTC (permalink / raw)
To: Zhen Lei
Cc: Guenter Roeck, Greg Kroah-Hartman, linux-usb, linux-kernel,
Hans de Goede
On Wed, Apr 07, 2021 at 05:15:40PM +0800, Zhen Lei wrote:
> Fixes the following W=1 kernel build warning:
>
> drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
>
> The reference to the variable 'tcpm_altmode_ops' is deleted by the
> commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
> mechanism").
>
> By the way, the static functions referenced only by the variable
> 'tcpm_altmode_ops' are deleted accordingly.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Oh, I thought this was already fixed. Should this go into the stable
trees as well?
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 60 -------------------------------------------
> 1 file changed, 60 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index ce7af398c7c1c1f..2f89bae29c0c297 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1365,14 +1365,6 @@ static void tcpm_queue_vdm(struct tcpm_port *port, const u32 header,
> mod_vdm_delayed_work(port, 0);
> }
>
> -static void tcpm_queue_vdm_unlocked(struct tcpm_port *port, const u32 header,
> - const u32 *data, int cnt)
> -{
> - mutex_lock(&port->lock);
> - tcpm_queue_vdm(port, header, data, cnt);
> - mutex_unlock(&port->lock);
> -}
> -
> static void svdm_consume_identity(struct tcpm_port *port, const u32 *p, int cnt)
> {
> u32 vdo = p[VDO_INDEX_IDH];
> @@ -1705,8 +1697,6 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
> *
> * And we also have this ordering:
> * 1. alt-mode driver takes the alt-mode's lock
> - * 2. alt-mode driver calls tcpm_altmode_enter which takes the
> - * tcpm port lock
> *
> * Dropping our lock here avoids this.
> */
> @@ -2060,56 +2050,6 @@ static int tcpm_validate_caps(struct tcpm_port *port, const u32 *pdo,
> return 0;
> }
>
> -static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
> -{
> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
> - int svdm_version;
> - u32 header;
> -
> - svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
> - if (svdm_version < 0)
> - return svdm_version;
> -
> - header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
> - header |= VDO_OPOS(altmode->mode);
> -
> - tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0);
> - return 0;
> -}
> -
> -static int tcpm_altmode_exit(struct typec_altmode *altmode)
> -{
> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
> - int svdm_version;
> - u32 header;
> -
> - svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
> - if (svdm_version < 0)
> - return svdm_version;
> -
> - header = VDO(altmode->svid, 1, svdm_version, CMD_EXIT_MODE);
> - header |= VDO_OPOS(altmode->mode);
> -
> - tcpm_queue_vdm_unlocked(port, header, NULL, 0);
> - return 0;
> -}
> -
> -static int tcpm_altmode_vdm(struct typec_altmode *altmode,
> - u32 header, const u32 *data, int count)
> -{
> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
> -
> - tcpm_queue_vdm_unlocked(port, header, data, count - 1);
> -
> - return 0;
> -}
> -
> -static const struct typec_altmode_ops tcpm_altmode_ops = {
> - .enter = tcpm_altmode_enter,
> - .exit = tcpm_altmode_exit,
> - .vdm = tcpm_altmode_vdm,
> -};
> -
> /*
> * PD (data, control) command handling functions
> */
> --
> 1.8.3
>
--
heikki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-08 8:28 ` Heikki Krogerus
@ 2021-04-08 8:38 ` Greg Kroah-Hartman
2021-04-08 8:44 ` Heikki Krogerus
2021-04-08 13:55 ` Guenter Roeck
1 sibling, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2021-04-08 8:38 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Zhen Lei, Guenter Roeck, linux-usb, linux-kernel, Hans de Goede
On Thu, Apr 08, 2021 at 11:28:09AM +0300, Heikki Krogerus wrote:
> On Wed, Apr 07, 2021 at 05:15:40PM +0800, Zhen Lei wrote:
> > Fixes the following W=1 kernel build warning:
> >
> > drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
> >
> > The reference to the variable 'tcpm_altmode_ops' is deleted by the
> > commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
> > mechanism").
> >
> > By the way, the static functions referenced only by the variable
> > 'tcpm_altmode_ops' are deleted accordingly.
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>
> Oh, I thought this was already fixed. Should this go into the stable
> trees as well?
We do not build kernels by default with "W=1" yet, so it's not needed
in stable kernels.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-08 8:38 ` Greg Kroah-Hartman
@ 2021-04-08 8:44 ` Heikki Krogerus
0 siblings, 0 replies; 11+ messages in thread
From: Heikki Krogerus @ 2021-04-08 8:44 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Zhen Lei, Guenter Roeck, linux-usb, linux-kernel, Hans de Goede
On Thu, Apr 08, 2021 at 10:38:15AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Apr 08, 2021 at 11:28:09AM +0300, Heikki Krogerus wrote:
> > On Wed, Apr 07, 2021 at 05:15:40PM +0800, Zhen Lei wrote:
> > > Fixes the following W=1 kernel build warning:
> > >
> > > drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
> > >
> > > The reference to the variable 'tcpm_altmode_ops' is deleted by the
> > > commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
> > > mechanism").
> > >
> > > By the way, the static functions referenced only by the variable
> > > 'tcpm_altmode_ops' are deleted accordingly.
> > >
> > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> >
> > Oh, I thought this was already fixed. Should this go into the stable
> > trees as well?
>
> We do not build kernels by default with "W=1" yet, so it's not needed
> in stable kernels.
Okay, got it.
thanks,
--
heikki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-07 9:15 [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops' Zhen Lei
2021-04-08 8:28 ` Heikki Krogerus
@ 2021-04-08 9:10 ` Hans de Goede
2021-04-08 9:25 ` Heikki Krogerus
1 sibling, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2021-04-08 9:10 UTC (permalink / raw)
To: Zhen Lei, Guenter Roeck, Heikki Krogerus, Greg Kroah-Hartman,
linux-usb, linux-kernel
Hi,
On 4/7/21 11:15 AM, Zhen Lei wrote:
> Fixes the following W=1 kernel build warning:
>
> drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
>
> The reference to the variable 'tcpm_altmode_ops' is deleted by the
> commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
> mechanism").
>
> By the way, the static functions referenced only by the variable
> 'tcpm_altmode_ops' are deleted accordingly.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
I have a patch pending:
https://www.spinics.net/lists/linux-usb/msg197684.html
Which actually uses this. I really need to (and plan to) brush the dust of
this one soon and submit a new version.
As such I would prefer for these ops to not get removed. But I guess I
can always include a patch in my series reverting the removal...
Regards,
Hans
> ---
> drivers/usb/typec/tcpm/tcpm.c | 60 -------------------------------------------
> 1 file changed, 60 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index ce7af398c7c1c1f..2f89bae29c0c297 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1365,14 +1365,6 @@ static void tcpm_queue_vdm(struct tcpm_port *port, const u32 header,
> mod_vdm_delayed_work(port, 0);
> }
>
> -static void tcpm_queue_vdm_unlocked(struct tcpm_port *port, const u32 header,
> - const u32 *data, int cnt)
> -{
> - mutex_lock(&port->lock);
> - tcpm_queue_vdm(port, header, data, cnt);
> - mutex_unlock(&port->lock);
> -}
> -
> static void svdm_consume_identity(struct tcpm_port *port, const u32 *p, int cnt)
> {
> u32 vdo = p[VDO_INDEX_IDH];
> @@ -1705,8 +1697,6 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
> *
> * And we also have this ordering:
> * 1. alt-mode driver takes the alt-mode's lock
> - * 2. alt-mode driver calls tcpm_altmode_enter which takes the
> - * tcpm port lock
> *
> * Dropping our lock here avoids this.
> */
> @@ -2060,56 +2050,6 @@ static int tcpm_validate_caps(struct tcpm_port *port, const u32 *pdo,
> return 0;
> }
>
> -static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
> -{
> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
> - int svdm_version;
> - u32 header;
> -
> - svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
> - if (svdm_version < 0)
> - return svdm_version;
> -
> - header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
> - header |= VDO_OPOS(altmode->mode);
> -
> - tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0);
> - return 0;
> -}
> -
> -static int tcpm_altmode_exit(struct typec_altmode *altmode)
> -{
> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
> - int svdm_version;
> - u32 header;
> -
> - svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
> - if (svdm_version < 0)
> - return svdm_version;
> -
> - header = VDO(altmode->svid, 1, svdm_version, CMD_EXIT_MODE);
> - header |= VDO_OPOS(altmode->mode);
> -
> - tcpm_queue_vdm_unlocked(port, header, NULL, 0);
> - return 0;
> -}
> -
> -static int tcpm_altmode_vdm(struct typec_altmode *altmode,
> - u32 header, const u32 *data, int count)
> -{
> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
> -
> - tcpm_queue_vdm_unlocked(port, header, data, count - 1);
> -
> - return 0;
> -}
> -
> -static const struct typec_altmode_ops tcpm_altmode_ops = {
> - .enter = tcpm_altmode_enter,
> - .exit = tcpm_altmode_exit,
> - .vdm = tcpm_altmode_vdm,
> -};
> -
> /*
> * PD (data, control) command handling functions
> */
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-08 9:10 ` Hans de Goede
@ 2021-04-08 9:25 ` Heikki Krogerus
2021-04-08 9:36 ` Hans de Goede
0 siblings, 1 reply; 11+ messages in thread
From: Heikki Krogerus @ 2021-04-08 9:25 UTC (permalink / raw)
To: Hans de Goede
Cc: Zhen Lei, Guenter Roeck, Greg Kroah-Hartman, linux-usb, linux-kernel
On Thu, Apr 08, 2021 at 11:10:38AM +0200, Hans de Goede wrote:
> Hi,
>
> On 4/7/21 11:15 AM, Zhen Lei wrote:
> > Fixes the following W=1 kernel build warning:
> >
> > drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
> >
> > The reference to the variable 'tcpm_altmode_ops' is deleted by the
> > commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
> > mechanism").
> >
> > By the way, the static functions referenced only by the variable
> > 'tcpm_altmode_ops' are deleted accordingly.
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>
> I have a patch pending:
>
> https://www.spinics.net/lists/linux-usb/msg197684.html
>
> Which actually uses this. I really need to (and plan to) brush the dust of
> this one soon and submit a new version.
>
> As such I would prefer for these ops to not get removed. But I guess I
> can always include a patch in my series reverting the removal...
Well, can we then just leave the ops there? If we're going to
re-introduce them back soon in any case, then why drop them in the
first place.
thanks,
--
heikki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-08 9:25 ` Heikki Krogerus
@ 2021-04-08 9:36 ` Hans de Goede
0 siblings, 0 replies; 11+ messages in thread
From: Hans de Goede @ 2021-04-08 9:36 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Zhen Lei, Guenter Roeck, Greg Kroah-Hartman, linux-usb, linux-kernel
Hi,
On 4/8/21 11:25 AM, Heikki Krogerus wrote:
> On Thu, Apr 08, 2021 at 11:10:38AM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 4/7/21 11:15 AM, Zhen Lei wrote:
>>> Fixes the following W=1 kernel build warning:
>>>
>>> drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
>>>
>>> The reference to the variable 'tcpm_altmode_ops' is deleted by the
>>> commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
>>> mechanism").
>>>
>>> By the way, the static functions referenced only by the variable
>>> 'tcpm_altmode_ops' are deleted accordingly.
>>>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>
>> I have a patch pending:
>>
>> https://www.spinics.net/lists/linux-usb/msg197684.html
>>
>> Which actually uses this. I really need to (and plan to) brush the dust of
>> this one soon and submit a new version.
>>
>> As such I would prefer for these ops to not get removed. But I guess I
>> can always include a patch in my series reverting the removal...
>
> Well, can we then just leave the ops there? If we're going to
> re-introduce them back soon in any case, then why drop them in the
> first place.
Yes I'm in favor of just leaving them in place too, sorry if that was
not clear.
Regards,
Hans
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-08 8:28 ` Heikki Krogerus
2021-04-08 8:38 ` Greg Kroah-Hartman
@ 2021-04-08 13:55 ` Guenter Roeck
2021-04-08 17:14 ` Hans de Goede
1 sibling, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2021-04-08 13:55 UTC (permalink / raw)
To: Heikki Krogerus, Zhen Lei
Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, Hans de Goede
On 4/8/21 1:28 AM, Heikki Krogerus wrote:
> On Wed, Apr 07, 2021 at 05:15:40PM +0800, Zhen Lei wrote:
>> Fixes the following W=1 kernel build warning:
>>
>> drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
>>
>> The reference to the variable 'tcpm_altmode_ops' is deleted by the
>> commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
>> mechanism").
>>
>> By the way, the static functions referenced only by the variable
>> 'tcpm_altmode_ops' are deleted accordingly.
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>
> Oh, I thought this was already fixed. Should this go into the stable
> trees as well?
>
I thought there was some code supposed to be coming which would make use of it,
but my memory may defeat me. Either case, it is getting old. It it is ever needed,
it can be reintroduced.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Guenter
> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>
>> ---
>> drivers/usb/typec/tcpm/tcpm.c | 60 -------------------------------------------
>> 1 file changed, 60 deletions(-)
>>
>> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
>> index ce7af398c7c1c1f..2f89bae29c0c297 100644
>> --- a/drivers/usb/typec/tcpm/tcpm.c
>> +++ b/drivers/usb/typec/tcpm/tcpm.c
>> @@ -1365,14 +1365,6 @@ static void tcpm_queue_vdm(struct tcpm_port *port, const u32 header,
>> mod_vdm_delayed_work(port, 0);
>> }
>>
>> -static void tcpm_queue_vdm_unlocked(struct tcpm_port *port, const u32 header,
>> - const u32 *data, int cnt)
>> -{
>> - mutex_lock(&port->lock);
>> - tcpm_queue_vdm(port, header, data, cnt);
>> - mutex_unlock(&port->lock);
>> -}
>> -
>> static void svdm_consume_identity(struct tcpm_port *port, const u32 *p, int cnt)
>> {
>> u32 vdo = p[VDO_INDEX_IDH];
>> @@ -1705,8 +1697,6 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
>> *
>> * And we also have this ordering:
>> * 1. alt-mode driver takes the alt-mode's lock
>> - * 2. alt-mode driver calls tcpm_altmode_enter which takes the
>> - * tcpm port lock
>> *
>> * Dropping our lock here avoids this.
>> */
>> @@ -2060,56 +2050,6 @@ static int tcpm_validate_caps(struct tcpm_port *port, const u32 *pdo,
>> return 0;
>> }
>>
>> -static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
>> -{
>> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
>> - int svdm_version;
>> - u32 header;
>> -
>> - svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
>> - if (svdm_version < 0)
>> - return svdm_version;
>> -
>> - header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
>> - header |= VDO_OPOS(altmode->mode);
>> -
>> - tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0);
>> - return 0;
>> -}
>> -
>> -static int tcpm_altmode_exit(struct typec_altmode *altmode)
>> -{
>> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
>> - int svdm_version;
>> - u32 header;
>> -
>> - svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
>> - if (svdm_version < 0)
>> - return svdm_version;
>> -
>> - header = VDO(altmode->svid, 1, svdm_version, CMD_EXIT_MODE);
>> - header |= VDO_OPOS(altmode->mode);
>> -
>> - tcpm_queue_vdm_unlocked(port, header, NULL, 0);
>> - return 0;
>> -}
>> -
>> -static int tcpm_altmode_vdm(struct typec_altmode *altmode,
>> - u32 header, const u32 *data, int count)
>> -{
>> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
>> -
>> - tcpm_queue_vdm_unlocked(port, header, data, count - 1);
>> -
>> - return 0;
>> -}
>> -
>> -static const struct typec_altmode_ops tcpm_altmode_ops = {
>> - .enter = tcpm_altmode_enter,
>> - .exit = tcpm_altmode_exit,
>> - .vdm = tcpm_altmode_vdm,
>> -};
>> -
>> /*
>> * PD (data, control) command handling functions
>> */
>> --
>> 1.8.3
>>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-08 13:55 ` Guenter Roeck
@ 2021-04-08 17:14 ` Hans de Goede
2021-04-09 9:37 ` Heikki Krogerus
0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2021-04-08 17:14 UTC (permalink / raw)
To: Guenter Roeck, Heikki Krogerus, Zhen Lei
Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
Hi,
On 4/8/21 3:55 PM, Guenter Roeck wrote:
> On 4/8/21 1:28 AM, Heikki Krogerus wrote:
>> On Wed, Apr 07, 2021 at 05:15:40PM +0800, Zhen Lei wrote:
>>> Fixes the following W=1 kernel build warning:
>>>
>>> drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
>>>
>>> The reference to the variable 'tcpm_altmode_ops' is deleted by the
>>> commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
>>> mechanism").
>>>
>>> By the way, the static functions referenced only by the variable
>>> 'tcpm_altmode_ops' are deleted accordingly.
>>>
>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>
>> Oh, I thought this was already fixed. Should this go into the stable
>> trees as well?
>>
>
> I thought there was some code supposed to be coming which would make use of it,
> but my memory may defeat me.
There is code coming which uses this; and this is necessary to make
DP altmode work on some devices.
I have dropped the ball a bit on posting a v2 of my series using this.
I'll prepare a v2 of my series, addressing Heikki's review comments
to my v1 right away. I'll post a v2 at the latest tomorrow.
This is something which is on my TODO list anyways and this way we will
save some churn with these functions going away only to be re-introduced
again relatively soon after they were removed.
Regards,
Hans
> Either case, it is getting old. It it is ever needed,
> it can be reintroduced.
>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>
> Guenter
>
>> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>>
>>> ---
>>> drivers/usb/typec/tcpm/tcpm.c | 60 -------------------------------------------
>>> 1 file changed, 60 deletions(-)
>>>
>>> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
>>> index ce7af398c7c1c1f..2f89bae29c0c297 100644
>>> --- a/drivers/usb/typec/tcpm/tcpm.c
>>> +++ b/drivers/usb/typec/tcpm/tcpm.c
>>> @@ -1365,14 +1365,6 @@ static void tcpm_queue_vdm(struct tcpm_port *port, const u32 header,
>>> mod_vdm_delayed_work(port, 0);
>>> }
>>>
>>> -static void tcpm_queue_vdm_unlocked(struct tcpm_port *port, const u32 header,
>>> - const u32 *data, int cnt)
>>> -{
>>> - mutex_lock(&port->lock);
>>> - tcpm_queue_vdm(port, header, data, cnt);
>>> - mutex_unlock(&port->lock);
>>> -}
>>> -
>>> static void svdm_consume_identity(struct tcpm_port *port, const u32 *p, int cnt)
>>> {
>>> u32 vdo = p[VDO_INDEX_IDH];
>>> @@ -1705,8 +1697,6 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
>>> *
>>> * And we also have this ordering:
>>> * 1. alt-mode driver takes the alt-mode's lock
>>> - * 2. alt-mode driver calls tcpm_altmode_enter which takes the
>>> - * tcpm port lock
>>> *
>>> * Dropping our lock here avoids this.
>>> */
>>> @@ -2060,56 +2050,6 @@ static int tcpm_validate_caps(struct tcpm_port *port, const u32 *pdo,
>>> return 0;
>>> }
>>>
>>> -static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
>>> -{
>>> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
>>> - int svdm_version;
>>> - u32 header;
>>> -
>>> - svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
>>> - if (svdm_version < 0)
>>> - return svdm_version;
>>> -
>>> - header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
>>> - header |= VDO_OPOS(altmode->mode);
>>> -
>>> - tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0);
>>> - return 0;
>>> -}
>>> -
>>> -static int tcpm_altmode_exit(struct typec_altmode *altmode)
>>> -{
>>> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
>>> - int svdm_version;
>>> - u32 header;
>>> -
>>> - svdm_version = typec_get_negotiated_svdm_version(port->typec_port);
>>> - if (svdm_version < 0)
>>> - return svdm_version;
>>> -
>>> - header = VDO(altmode->svid, 1, svdm_version, CMD_EXIT_MODE);
>>> - header |= VDO_OPOS(altmode->mode);
>>> -
>>> - tcpm_queue_vdm_unlocked(port, header, NULL, 0);
>>> - return 0;
>>> -}
>>> -
>>> -static int tcpm_altmode_vdm(struct typec_altmode *altmode,
>>> - u32 header, const u32 *data, int count)
>>> -{
>>> - struct tcpm_port *port = typec_altmode_get_drvdata(altmode);
>>> -
>>> - tcpm_queue_vdm_unlocked(port, header, data, count - 1);
>>> -
>>> - return 0;
>>> -}
>>> -
>>> -static const struct typec_altmode_ops tcpm_altmode_ops = {
>>> - .enter = tcpm_altmode_enter,
>>> - .exit = tcpm_altmode_exit,
>>> - .vdm = tcpm_altmode_vdm,
>>> -};
>>> -
>>> /*
>>> * PD (data, control) command handling functions
>>> */
>>> --
>>> 1.8.3
>>>
>>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
2021-04-08 17:14 ` Hans de Goede
@ 2021-04-09 9:37 ` Heikki Krogerus
0 siblings, 0 replies; 11+ messages in thread
From: Heikki Krogerus @ 2021-04-09 9:37 UTC (permalink / raw)
To: Hans de Goede, Greg Kroah-Hartman
Cc: Guenter Roeck, Zhen Lei, linux-usb, linux-kernel
On Thu, Apr 08, 2021 at 07:14:01PM +0200, Hans de Goede wrote:
> Hi,
>
> On 4/8/21 3:55 PM, Guenter Roeck wrote:
> > On 4/8/21 1:28 AM, Heikki Krogerus wrote:
> >> On Wed, Apr 07, 2021 at 05:15:40PM +0800, Zhen Lei wrote:
> >>> Fixes the following W=1 kernel build warning:
> >>>
> >>> drivers/usb/typec/tcpm/tcpm.c:2107:39: warning: ‘tcpm_altmode_ops’ defined but not used [-Wunused-const-variable=]
> >>>
> >>> The reference to the variable 'tcpm_altmode_ops' is deleted by the
> >>> commit a079973f462a ("usb: typec: tcpm: Remove tcpc_config configuration
> >>> mechanism").
> >>>
> >>> By the way, the static functions referenced only by the variable
> >>> 'tcpm_altmode_ops' are deleted accordingly.
> >>>
> >>> Reported-by: Hulk Robot <hulkci@huawei.com>
> >>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> >>
> >> Oh, I thought this was already fixed. Should this go into the stable
> >> trees as well?
> >>
> >
> > I thought there was some code supposed to be coming which would make use of it,
> > but my memory may defeat me.
>
> There is code coming which uses this; and this is necessary to make
> DP altmode work on some devices.
>
> I have dropped the ball a bit on posting a v2 of my series using this.
>
> I'll prepare a v2 of my series, addressing Heikki's review comments
> to my v1 right away. I'll post a v2 at the latest tomorrow.
>
> This is something which is on my TODO list anyways and this way we will
> save some churn with these functions going away only to be re-introduced
> again relatively soon after they were removed.
Cool. Greg, I think we can skip this patch then.
thanks,
--
heikki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops'
@ 2021-04-07 21:00 kernel test robot
0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-04-07 21:00 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4861 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210407091540.2815-1-thunder.leizhen@huawei.com>
References: <20210407091540.2815-1-thunder.leizhen@huawei.com>
TO: Zhen Lei <thunder.leizhen@huawei.com>
TO: Guenter Roeck <linux@roeck-us.net>
TO: Heikki Krogerus <heikki.krogerus@linux.intel.com>
TO: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
TO: "linux-usb" <linux-usb@vger.kernel.org>
TO: "linux-kernel" <linux-kernel@vger.kernel.org>
CC: Zhen Lei <thunder.leizhen@huawei.com>
CC: Hans de Goede <hdegoede@redhat.com>
Hi Zhen,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v5.12-rc6 next-20210407]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Zhen-Lei/usb-typec-tcpm-remove-unused-static-variable-tcpm_altmode_ops/20210407-171848
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
:::::: branch date: 12 hours ago
:::::: commit date: 12 hours ago
compiler: xtensa-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/usb/typec/tcpm/tcpm.c:1363:29: warning: Possible null pointer dereference: data [nullPointer]
memcpy(&port->vdo_data[1], data, sizeof(u32) * cnt);
^
drivers/usb/typec/tcpm/tcpm.c:3604:55: note: Calling function 'tcpm_send_vdm', 4th argument 'NULL' value is 0
tcpm_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0);
^
drivers/usb/typec/tcpm/tcpm.c:1767:31: note: Calling function 'tcpm_queue_vdm', 3rd argument 'data' value is 0
tcpm_queue_vdm(port, header, data, count);
^
drivers/usb/typec/tcpm/tcpm.c:1363:29: note: Null pointer dereference
memcpy(&port->vdo_data[1], data, sizeof(u32) * cnt);
^
vim +1363 drivers/usb/typec/tcpm/tcpm.c
0908c5aca31eb5 drivers/usb/typec/tcpm/tcpm.c Kyle Tso 2021-01-14 1349
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1350 /*
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1351 * VDM/VDO handling functions
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1352 */
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1353 static void tcpm_queue_vdm(struct tcpm_port *port, const u32 header,
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1354 const u32 *data, int cnt)
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1355 {
03eafcfb60c0da drivers/usb/typec/tcpm/tcpm.c Hans de Goede 2020-07-24 1356 WARN_ON(!mutex_is_locked(&port->lock));
03eafcfb60c0da drivers/usb/typec/tcpm/tcpm.c Hans de Goede 2020-07-24 1357
754498c1d6369d drivers/usb/typec/tcpm/tcpm.c Hans de Goede 2020-07-24 1358 /* Make sure we are not still processing a previous VDM packet */
754498c1d6369d drivers/usb/typec/tcpm/tcpm.c Hans de Goede 2020-07-24 1359 WARN_ON(port->vdm_state > VDM_STATE_DONE);
754498c1d6369d drivers/usb/typec/tcpm/tcpm.c Hans de Goede 2020-07-24 1360
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1361 port->vdo_count = cnt + 1;
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1362 port->vdo_data[0] = header;
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 @1363 memcpy(&port->vdo_data[1], data, sizeof(u32) * cnt);
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1364 /* Set ready, vdm state machine will actually send */
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1365 port->vdm_retries = 0;
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1366 port->vdm_state = VDM_STATE_READY;
5f2b8d87bca528 drivers/usb/typec/tcpm/tcpm.c Hans de Goede 2020-07-24 1367
3ed8e1c2ac9914 drivers/usb/typec/tcpm/tcpm.c Badhri Jagan Sridharan 2020-08-18 1368 mod_vdm_delayed_work(port, 0);
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1369 }
f0690a25a140b8 drivers/staging/typec/tcpm.c Guenter Roeck 2017-04-27 1370
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-04-09 9:37 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 9:15 [PATCH 1/1] usb: typec: tcpm: remove unused static variable 'tcpm_altmode_ops' Zhen Lei
2021-04-08 8:28 ` Heikki Krogerus
2021-04-08 8:38 ` Greg Kroah-Hartman
2021-04-08 8:44 ` Heikki Krogerus
2021-04-08 13:55 ` Guenter Roeck
2021-04-08 17:14 ` Hans de Goede
2021-04-09 9:37 ` Heikki Krogerus
2021-04-08 9:10 ` Hans de Goede
2021-04-08 9:25 ` Heikki Krogerus
2021-04-08 9:36 ` Hans de Goede
2021-04-07 21:00 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.