Re: [PATCH v6 2/4] can: m_can: Rename m_can_priv to m_can_classdev

2019-03-04 Thread Wolfgang Grandegger



Am 04.03.19 um 19:14 schrieb Dan Murphy:
> Wolfgang
> 
> On 3/4/19 11:31 AM, Wolfgang Grandegger wrote:
>> Hello,
>>
>> there are still "LTL" after renaming m_can_priv to m_can_classdev.
>>
> 
> Yes I know but some of those become unreadable if I break them apart.
> 
> But if you want me to break them I can do it.
> 
> For instance
>   struct m_can_plat_priv *priv = (struct m_can_plat_priv 
> *)m_can_class->device_data;
> 
> will become
> 
>   struct m_can_plat_priv *priv =
>   (struct m_can_plat_priv 
> *)m_can_class->device_data;

Perfect! See also my comment below.

> 
>> Am 01.03.19 um 19:50 schrieb Dan Murphy:
>>> Rename the common m_can_priv class structure to
>>> m_can_classdev as this is more descriptive.
>>
>> If you change the struct name, I think you should also change the
>> variable name to something more meaning full e.g.:
>>
>>   struct m_can_classdev *cdev
>>
>> instead of
>>
>>   struct m_can_classdev *priv
>>
>>
> 
> Ack.  This change will grow this patch as s/priv/cdev is used 250x

That's the price for changing the name. As we have it in a separate
patch, it should be OK.

Ideally, also m_can_platform.c and tcan4x5x.c should then use that name
for "struct m_can_classdev".

Wolfgang.


Re: [PATCH v6 2/4] can: m_can: Rename m_can_priv to m_can_classdev

2019-03-04 Thread Dan Murphy
Wolfgang

On 3/4/19 11:31 AM, Wolfgang Grandegger wrote:
> Hello,
> 
> there are still "LTL" after renaming m_can_priv to m_can_classdev.
> 

Yes I know but some of those become unreadable if I break them apart.

But if you want me to break them I can do it.

For instance
struct m_can_plat_priv *priv = (struct m_can_plat_priv 
*)m_can_class->device_data;

will become

struct m_can_plat_priv *priv =
(struct m_can_plat_priv 
*)m_can_class->device_data;

> Am 01.03.19 um 19:50 schrieb Dan Murphy:
>> Rename the common m_can_priv class structure to
>> m_can_classdev as this is more descriptive.
> 
> If you change the struct name, I think you should also change the
> variable name to something more meaning full e.g.:
> 
>   struct m_can_classdev *cdev
> 
> instead of
> 
>   struct m_can_classdev *priv
> 
> 

Ack.  This change will grow this patch as s/priv/cdev is used 250x

Dan

> ... snip ...
> 
> Wolfgang.
> 


-- 
--
Dan Murphy


Re: [PATCH v6 2/4] can: m_can: Rename m_can_priv to m_can_classdev

2019-03-04 Thread Wolfgang Grandegger
Hello,

there are still "LTL" after renaming m_can_priv to m_can_classdev.

Am 01.03.19 um 19:50 schrieb Dan Murphy:
> Rename the common m_can_priv class structure to
> m_can_classdev as this is more descriptive.

If you change the struct name, I think you should also change the
variable name to something more meaning full e.g.:

  struct m_can_classdev *cdev

instead of

  struct m_can_classdev *priv


... snip ...

Wolfgang.


[PATCH v6 2/4] can: m_can: Rename m_can_priv to m_can_classdev

2019-03-01 Thread Dan Murphy
Rename the common m_can_priv class structure to
m_can_classdev as this is more descriptive.

Signed-off-by: Dan Murphy 
---

v6 - No changes only rebase changes possibly can squash into the first patch - 
https://lore.kernel.org/patchwork/patch/1042444/

 drivers/net/can/m_can/m_can.c  | 94 +-
 drivers/net/can/m_can/m_can.h  | 28 
 drivers/net/can/m_can/m_can_platform.c | 16 ++---
 3 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index b37d0886f9cb..817e623c8a32 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -319,7 +319,7 @@ enum m_can_reg {
 #define TX_EVENT_MM_SHIFT  TX_BUF_MM_SHIFT
 #define TX_EVENT_MM_MASK   (0xff << TX_EVENT_MM_SHIFT)
 
-static u32 m_can_read(struct m_can_priv *priv, enum m_can_reg reg)
+static u32 m_can_read(struct m_can_classdev *priv, enum m_can_reg reg)
 {
if (priv->ops->read_reg)
return priv->ops->read_reg(priv, reg);
@@ -327,7 +327,7 @@ static u32 m_can_read(struct m_can_priv *priv, enum 
m_can_reg reg)
return -EINVAL;
 }
 
-static int m_can_write(struct m_can_priv *priv, enum m_can_reg reg, u32 val)
+static int m_can_write(struct m_can_classdev *priv, enum m_can_reg reg, u32 
val)
 {
if (priv->ops->write_reg)
return priv->ops->write_reg(priv, reg, val);
@@ -335,7 +335,7 @@ static int m_can_write(struct m_can_priv *priv, enum 
m_can_reg reg, u32 val)
return -EINVAL;
 }
 
-static u32 m_can_fifo_read(struct m_can_priv *priv,
+static u32 m_can_fifo_read(struct m_can_classdev *priv,
   u32 fgi, unsigned int offset)
 {
u32 addr_offset = priv->mcfg[MRAM_RXF0].off + fgi * RXF0_ELEMENT_SIZE +
@@ -347,7 +347,7 @@ static u32 m_can_fifo_read(struct m_can_priv *priv,
return -EINVAL;
 }
 
-static u32 m_can_fifo_write(struct m_can_priv *priv,
+static u32 m_can_fifo_write(struct m_can_classdev *priv,
u32 fpi, unsigned int offset, u32 val)
 {
u32 addr_offset = priv->mcfg[MRAM_TXB].off + fpi * TXB_ELEMENT_SIZE +
@@ -359,7 +359,7 @@ static u32 m_can_fifo_write(struct m_can_priv *priv,
return -EINVAL;
 }
 
-static u32 m_can_fifo_write_no_off(struct m_can_priv *priv,
+static u32 m_can_fifo_write_no_off(struct m_can_classdev *priv,
   u32 fpi, u32 val)
 {
if (priv->ops->write_fifo)
@@ -368,7 +368,7 @@ static u32 m_can_fifo_write_no_off(struct m_can_priv *priv,
return 0;
 }
 
-static u32 m_can_txe_fifo_read(struct m_can_priv *priv, u32 fgi, u32 offset)
+static u32 m_can_txe_fifo_read(struct m_can_classdev *priv, u32 fgi, u32 
offset)
 {
u32 addr_offset = priv->mcfg[MRAM_TXE].off + fgi * TXE_ELEMENT_SIZE +
  offset;
@@ -379,12 +379,12 @@ static u32 m_can_txe_fifo_read(struct m_can_priv *priv, 
u32 fgi, u32 offset)
return -EINVAL;
 }
 
-static inline bool m_can_tx_fifo_full(struct m_can_priv *priv)
+static inline bool m_can_tx_fifo_full(struct m_can_classdev *priv)
 {
return !!(m_can_read(priv, M_CAN_TXFQS) & TXFQS_TFQF);
 }
 
-void m_can_config_endisable(struct m_can_priv *priv, bool enable)
+void m_can_config_endisable(struct m_can_classdev *priv, bool enable)
 {
u32 cccr = m_can_read(priv, M_CAN_CCCR);
u32 timeout = 10;
@@ -417,13 +417,13 @@ void m_can_config_endisable(struct m_can_priv *priv, bool 
enable)
}
 }
 
-static inline void m_can_enable_all_interrupts(struct m_can_priv *priv)
+static inline void m_can_enable_all_interrupts(struct m_can_classdev *priv)
 {
/* Only interrupt line 0 is used in this driver */
m_can_write(priv, M_CAN_ILE, ILE_EINT0);
 }
 
-static inline void m_can_disable_all_interrupts(struct m_can_priv *priv)
+static inline void m_can_disable_all_interrupts(struct m_can_classdev *priv)
 {
m_can_write(priv, M_CAN_ILE, 0x0);
 }
@@ -431,7 +431,7 @@ static inline void m_can_disable_all_interrupts(struct 
m_can_priv *priv)
 static void m_can_read_fifo(struct net_device *dev, u32 rxfs)
 {
struct net_device_stats *stats = >stats;
-   struct m_can_priv *priv = netdev_priv(dev);
+   struct m_can_classdev *priv = netdev_priv(dev);
struct canfd_frame *cf;
struct sk_buff *skb;
u32 id, fgi, dlc;
@@ -488,7 +488,7 @@ static void m_can_read_fifo(struct net_device *dev, u32 
rxfs)
 
 static int m_can_do_rx_poll(struct net_device *dev, int quota)
 {
-   struct m_can_priv *priv = netdev_priv(dev);
+   struct m_can_classdev *priv = netdev_priv(dev);
u32 pkts = 0;
u32 rxfs;
 
@@ -541,7 +541,7 @@ static int m_can_handle_lost_msg(struct net_device *dev)
 static int m_can_handle_lec_err(struct net_device *dev,
enum m_can_lec_type lec_type)
 {
-   struct m_can_priv *priv = netdev_priv(dev);
+