Re: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone structure

2013-01-09 Thread Greg KH
On Wed, Jan 09, 2013 at 09:21:23AM +, R, Durgadoss wrote:
> > -Original Message-
> > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > Sent: Tuesday, January 08, 2013 12:56 AM
> > To: R, Durgadoss
> > Cc: Zhang, Rui; linux...@vger.kernel.org; linux-kernel@vger.kernel.org;
> > eduardo.valen...@ti.com; hongbo.zh...@linaro.org; w...@nvidia.com
> > Subject: Re: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone
> > structure
> > 
> > On Mon, Jan 07, 2013 at 12:43:20PM +0530, Durgadoss R wrote:
> > > +struct thermal_cooling_device *get_cdev_by_name(const char *name)
> > > +{
> > > + struct thermal_cooling_device *pos;
> > > + struct thermal_cooling_device *cdev = NULL;
> > > +
> > > + mutex_lock(_list_lock);
> > > + for_each_cdev(pos) {
> > > + if (!strnicmp(pos->type, name, THERMAL_NAME_LENGTH)) {
> > > + cdev = pos;
> > > + break;
> > > + }
> > > + }
> > > + mutex_unlock(_list_lock);
> > > + return cdev;
> > > +}
> > > +EXPORT_SYMBOL(get_cdev_by_name);
> > 
> > EXPORT_SYMBOL_GPL?
> 
> We have all other exports as EXPORT_SYMBOL in this file(thermal_sys.c)
> If _GPL is required, the we will do a single patch changing all of them to
> EXPORT_SYMBOL_GPL.

Fair enough.

> > You also forgot to increment the reference count, which is required for
> > all reference counted objects.
> 
> Sorry, I could not get what you are saying here.

You are doing a "get" call, yet you are failing to increment a reference
count on the object.  That isn't allowed and can cause bad problems.
Please use proper reference counting for your structures.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone structure

2013-01-09 Thread R, Durgadoss
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, January 08, 2013 12:56 AM
> To: R, Durgadoss
> Cc: Zhang, Rui; linux...@vger.kernel.org; linux-kernel@vger.kernel.org;
> eduardo.valen...@ti.com; hongbo.zh...@linaro.org; w...@nvidia.com
> Subject: Re: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone
> structure
> 
> On Mon, Jan 07, 2013 at 12:43:20PM +0530, Durgadoss R wrote:
> > +struct thermal_cooling_device *get_cdev_by_name(const char *name)
> > +{
> > +   struct thermal_cooling_device *pos;
> > +   struct thermal_cooling_device *cdev = NULL;
> > +
> > +   mutex_lock(_list_lock);
> > +   for_each_cdev(pos) {
> > +   if (!strnicmp(pos->type, name, THERMAL_NAME_LENGTH)) {
> > +   cdev = pos;
> > +   break;
> > +   }
> > +   }
> > +   mutex_unlock(_list_lock);
> > +   return cdev;
> > +}
> > +EXPORT_SYMBOL(get_cdev_by_name);
> 
> EXPORT_SYMBOL_GPL?

We have all other exports as EXPORT_SYMBOL in this file(thermal_sys.c)
If _GPL is required, the we will do a single patch changing all of them to
EXPORT_SYMBOL_GPL.

> 
> You also forgot to increment the reference count, which is required for
> all reference counted objects.

Sorry, I could not get what you are saying here.

Thanks,
Durga
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone structure

2013-01-09 Thread R, Durgadoss
 -Original Message-
 From: Greg KH [mailto:gre...@linuxfoundation.org]
 Sent: Tuesday, January 08, 2013 12:56 AM
 To: R, Durgadoss
 Cc: Zhang, Rui; linux...@vger.kernel.org; linux-kernel@vger.kernel.org;
 eduardo.valen...@ti.com; hongbo.zh...@linaro.org; w...@nvidia.com
 Subject: Re: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone
 structure
 
 On Mon, Jan 07, 2013 at 12:43:20PM +0530, Durgadoss R wrote:
  +struct thermal_cooling_device *get_cdev_by_name(const char *name)
  +{
  +   struct thermal_cooling_device *pos;
  +   struct thermal_cooling_device *cdev = NULL;
  +
  +   mutex_lock(cdev_list_lock);
  +   for_each_cdev(pos) {
  +   if (!strnicmp(pos-type, name, THERMAL_NAME_LENGTH)) {
  +   cdev = pos;
  +   break;
  +   }
  +   }
  +   mutex_unlock(cdev_list_lock);
  +   return cdev;
  +}
  +EXPORT_SYMBOL(get_cdev_by_name);
 
 EXPORT_SYMBOL_GPL?

We have all other exports as EXPORT_SYMBOL in this file(thermal_sys.c)
If _GPL is required, the we will do a single patch changing all of them to
EXPORT_SYMBOL_GPL.

 
 You also forgot to increment the reference count, which is required for
 all reference counted objects.

Sorry, I could not get what you are saying here.

Thanks,
Durga
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone structure

2013-01-09 Thread Greg KH
On Wed, Jan 09, 2013 at 09:21:23AM +, R, Durgadoss wrote:
  -Original Message-
  From: Greg KH [mailto:gre...@linuxfoundation.org]
  Sent: Tuesday, January 08, 2013 12:56 AM
  To: R, Durgadoss
  Cc: Zhang, Rui; linux...@vger.kernel.org; linux-kernel@vger.kernel.org;
  eduardo.valen...@ti.com; hongbo.zh...@linaro.org; w...@nvidia.com
  Subject: Re: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone
  structure
  
  On Mon, Jan 07, 2013 at 12:43:20PM +0530, Durgadoss R wrote:
   +struct thermal_cooling_device *get_cdev_by_name(const char *name)
   +{
   + struct thermal_cooling_device *pos;
   + struct thermal_cooling_device *cdev = NULL;
   +
   + mutex_lock(cdev_list_lock);
   + for_each_cdev(pos) {
   + if (!strnicmp(pos-type, name, THERMAL_NAME_LENGTH)) {
   + cdev = pos;
   + break;
   + }
   + }
   + mutex_unlock(cdev_list_lock);
   + return cdev;
   +}
   +EXPORT_SYMBOL(get_cdev_by_name);
  
  EXPORT_SYMBOL_GPL?
 
 We have all other exports as EXPORT_SYMBOL in this file(thermal_sys.c)
 If _GPL is required, the we will do a single patch changing all of them to
 EXPORT_SYMBOL_GPL.

Fair enough.

  You also forgot to increment the reference count, which is required for
  all reference counted objects.
 
 Sorry, I could not get what you are saying here.

You are doing a get call, yet you are failing to increment a reference
count on the object.  That isn't allowed and can cause bad problems.
Please use proper reference counting for your structures.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone structure

2013-01-07 Thread Greg KH
On Mon, Jan 07, 2013 at 12:43:20PM +0530, Durgadoss R wrote:
> +struct thermal_cooling_device *get_cdev_by_name(const char *name)
> +{
> + struct thermal_cooling_device *pos;
> + struct thermal_cooling_device *cdev = NULL;
> +
> + mutex_lock(_list_lock);
> + for_each_cdev(pos) {
> + if (!strnicmp(pos->type, name, THERMAL_NAME_LENGTH)) {
> + cdev = pos;
> + break;
> + }
> + }
> + mutex_unlock(_list_lock);
> + return cdev;
> +}
> +EXPORT_SYMBOL(get_cdev_by_name);

EXPORT_SYMBOL_GPL?

You also forgot to increment the reference count, which is required for
all reference counted objects.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/9] Thermal: Add APIs to bind cdev to new zone structure

2013-01-07 Thread Greg KH
On Mon, Jan 07, 2013 at 12:43:20PM +0530, Durgadoss R wrote:
 +struct thermal_cooling_device *get_cdev_by_name(const char *name)
 +{
 + struct thermal_cooling_device *pos;
 + struct thermal_cooling_device *cdev = NULL;
 +
 + mutex_lock(cdev_list_lock);
 + for_each_cdev(pos) {
 + if (!strnicmp(pos-type, name, THERMAL_NAME_LENGTH)) {
 + cdev = pos;
 + break;
 + }
 + }
 + mutex_unlock(cdev_list_lock);
 + return cdev;
 +}
 +EXPORT_SYMBOL(get_cdev_by_name);

EXPORT_SYMBOL_GPL?

You also forgot to increment the reference count, which is required for
all reference counted objects.

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/