linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] pwm: chip_data vs device_data
@ 2015-10-06  7:20 Olliver Schinagl
  2015-10-06  7:38 ` Thierry Reding
  0 siblings, 1 reply; 4+ messages in thread
From: Olliver Schinagl @ 2015-10-06  7:20 UTC (permalink / raw)
  To: Thierry Reding, linux-pwm, linux-kernel@vger.kernel.org; +Cc: Olliver Schinagl

Hey Thierry, list,

While working on something in the pwm framework, I noticed that the void 
*data in the pwm_device struct is called chip_data. Why is it not called 
device_data, since it is the data associated with a PWM device, rather 
then the chip, and on that note, if it really is chip related data (thus 
covering the whole chip, not just the single pwm device) why is there no 
chip_data in pwm_chip?

Again, is this something worth my time to add a device_data and rename 
chip_data?

Olliver

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

* Re: [RFC] pwm: chip_data vs device_data
  2015-10-06  7:20 [RFC] pwm: chip_data vs device_data Olliver Schinagl
@ 2015-10-06  7:38 ` Thierry Reding
  2015-10-06  8:21   ` Olliver Schinagl
  0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2015-10-06  7:38 UTC (permalink / raw)
  To: Olliver Schinagl
  Cc: linux-pwm, linux-kernel@vger.kernel.org, Olliver Schinagl

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]

On Tue, Oct 06, 2015 at 09:20:53AM +0200, Olliver Schinagl wrote:
> Hey Thierry, list,
> 
> While working on something in the pwm framework, I noticed that the void
> *data in the pwm_device struct is called chip_data. Why is it not called
> device_data, since it is the data associated with a PWM device, rather then
> the chip, and on that note, if it really is chip related data (thus covering
> the whole chip, not just the single pwm device) why is there no chip_data in
> pwm_chip?

The reason for the name is that it's chip-specific data associated with
a struct pwm_device. That is, a PWM chip implementation (i.e. driver)
can use it to keep per-PWM data that's not in struct pwm_device itself.

> Again, is this something worth my time to add a device_data and rename
> chip_data?

device_data would be redundant because it's already part of struct
pwm_device. Plain data might be okay, but I like the chip_ prefix
because it marks the data as being chip-specific data rather than
generic.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [RFC] pwm: chip_data vs device_data
  2015-10-06  7:38 ` Thierry Reding
@ 2015-10-06  8:21   ` Olliver Schinagl
  2015-10-06  9:14     ` Thierry Reding
  0 siblings, 1 reply; 4+ messages in thread
From: Olliver Schinagl @ 2015-10-06  8:21 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, linux-kernel@vger.kernel.org, Olliver Schinagl

Hey Thierry,

thans for your quick reply :)

On 06-10-15 09:38, Thierry Reding wrote:
> On Tue, Oct 06, 2015 at 09:20:53AM +0200, Olliver Schinagl wrote:
>> Hey Thierry, list,
>>
>> While working on something in the pwm framework, I noticed that the void
>> *data in the pwm_device struct is called chip_data. Why is it not called
>> device_data, since it is the data associated with a PWM device, rather then
>> the chip, and on that note, if it really is chip related data (thus covering
>> the whole chip, not just the single pwm device) why is there no chip_data in
>> pwm_chip?
> The reason for the name is that it's chip-specific data associated with
> a struct pwm_device. That is, a PWM chip implementation (i.e. driver)
> can use it to keep per-PWM data that's not in struct pwm_device itself.
Then I have to wrap my head around what is a chip and what is a device :)

To me, it seems that a chip can hold X number of pwm devices, and each 
pwm_device has a unique set of properties, duty, plarity, period. So it 
seems that some device specific data could go here as well, where i'm 
bad at examples now
>
>> Again, is this something worth my time to add a device_data and rename
>> chip_data?
> device_data would be redundant because it's already part of struct
> pwm_device. Plain data might be okay, but I like the chip_ prefix
> because it marks the data as being chip-specific data rather than
> generic.
well here i'd imagine the chip specific data (not allready in the struct).

I'll be subimtting my RFC work later this week after a little bit more 
work and will bring this up again :)

Olliver
>
> Thierry


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

* Re: [RFC] pwm: chip_data vs device_data
  2015-10-06  8:21   ` Olliver Schinagl
@ 2015-10-06  9:14     ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2015-10-06  9:14 UTC (permalink / raw)
  To: Olliver Schinagl
  Cc: linux-pwm, linux-kernel@vger.kernel.org, Olliver Schinagl

[-- Attachment #1: Type: text/plain, Size: 2034 bytes --]

On Tue, Oct 06, 2015 at 10:21:34AM +0200, Olliver Schinagl wrote:
> Hey Thierry,
> 
> thans for your quick reply :)
> 
> On 06-10-15 09:38, Thierry Reding wrote:
> >On Tue, Oct 06, 2015 at 09:20:53AM +0200, Olliver Schinagl wrote:
> >>Hey Thierry, list,
> >>
> >>While working on something in the pwm framework, I noticed that the void
> >>*data in the pwm_device struct is called chip_data. Why is it not called
> >>device_data, since it is the data associated with a PWM device, rather then
> >>the chip, and on that note, if it really is chip related data (thus covering
> >>the whole chip, not just the single pwm device) why is there no chip_data in
> >>pwm_chip?
> >The reason for the name is that it's chip-specific data associated with
> >a struct pwm_device. That is, a PWM chip implementation (i.e. driver)
> >can use it to keep per-PWM data that's not in struct pwm_device itself.
> Then I have to wrap my head around what is a chip and what is a device :)
> 
> To me, it seems that a chip can hold X number of pwm devices, and each
> pwm_device has a unique set of properties, duty, plarity, period. So it
> seems that some device specific data could go here as well, where i'm bad at
> examples now

I think we're really talking about the same thing here. This is used for
device-specific data. The chip_ prefix merely means that the chip driver
"owns" the data.

> >>Again, is this something worth my time to add a device_data and rename
> >>chip_data?
> >device_data would be redundant because it's already part of struct
> >pwm_device. Plain data might be okay, but I like the chip_ prefix
> >because it marks the data as being chip-specific data rather than
> >generic.
> well here i'd imagine the chip specific data (not allready in the struct).

Data specific to a chip is what you're supposed to embed in your driver-
specific data structure (which embeds struct pwm_chip). Like you said it
is data that pertains to the whole chip, so doesn't need to be per-PWM.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-10-06  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06  7:20 [RFC] pwm: chip_data vs device_data Olliver Schinagl
2015-10-06  7:38 ` Thierry Reding
2015-10-06  8:21   ` Olliver Schinagl
2015-10-06  9:14     ` Thierry Reding

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).