linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] remove do_get_state() callback
@ 2013-10-07 14:46 Marc Kleine-Budde
  2013-10-07 14:46 ` [PATCH 1/3] can: ti_hecc: remove priv->can.do_get_state() callback Marc Kleine-Budde
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-10-07 14:46 UTC (permalink / raw)
  To: linux-can; +Cc: kernel

Hello,

this patch series removes the do_get_state() callback from the driver
interface, as it is not needed to get the state of the interface.

regards,
Marc


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

* [PATCH 1/3] can: ti_hecc: remove priv->can.do_get_state() callback
  2013-10-07 14:46 [PATCH 0/3] remove do_get_state() callback Marc Kleine-Budde
@ 2013-10-07 14:46 ` Marc Kleine-Budde
  2013-10-07 14:46 ` [PATCH 2/3] can: dev: remove do_get_state() form can_fill_info() Marc Kleine-Budde
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-10-07 14:46 UTC (permalink / raw)
  To: linux-can; +Cc: kernel, Marc Kleine-Budde

This is a preparation patch to remove the priv->can.do_get_state() callback
completely.

This patch removes the priv->can.do_get_state() callback, as just returns
priv->can.state. The only user can_fill_info() already has direct access to
priv->can.state.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/ti_hecc.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index beb5ef8..60d95b4 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -286,15 +286,6 @@ static inline u32 hecc_get_bit(struct ti_hecc_priv *priv, int reg, u32 bit_mask)
 	return (hecc_read(priv, reg) & bit_mask) ? 1 : 0;
 }
 
-static int ti_hecc_get_state(const struct net_device *ndev,
-	enum can_state *state)
-{
-	struct ti_hecc_priv *priv = netdev_priv(ndev);
-
-	*state = priv->can.state;
-	return 0;
-}
-
 static int ti_hecc_set_btc(struct ti_hecc_priv *priv)
 {
 	struct can_bittiming *bit_timing = &priv->can.bittiming;
@@ -940,7 +931,6 @@ static int ti_hecc_probe(struct platform_device *pdev)
 
 	priv->can.bittiming_const = &ti_hecc_bittiming_const;
 	priv->can.do_set_mode = ti_hecc_do_set_mode;
-	priv->can.do_get_state = ti_hecc_get_state;
 	priv->can.do_get_berr_counter = ti_hecc_get_berr_counter;
 	priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
 
-- 
1.8.4.rc3


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

* [PATCH 2/3] can: dev: remove do_get_state() form can_fill_info()
  2013-10-07 14:46 [PATCH 0/3] remove do_get_state() callback Marc Kleine-Budde
  2013-10-07 14:46 ` [PATCH 1/3] can: ti_hecc: remove priv->can.do_get_state() callback Marc Kleine-Budde
@ 2013-10-07 14:46 ` Marc Kleine-Budde
  2013-10-07 14:46 ` [PATCH 3/3] can: dev: remove do_get_state() callback from struct can_priv Marc Kleine-Budde
  2013-10-07 19:25 ` [PATCH 0/3] remove do_get_state() callback Wolfgang Grandegger
  3 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-10-07 14:46 UTC (permalink / raw)
  To: linux-can; +Cc: kernel, Marc Kleine-Budde

As there is no driver that implements do_get_state(), remove the call from
can_fill_info().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/dev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index f9cba41..54eca2f 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -724,8 +724,6 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	struct can_berr_counter bec;
 	enum can_state state = priv->state;
 
-	if (priv->do_get_state)
-		priv->do_get_state(dev, &state);
 	if (nla_put_u32(skb, IFLA_CAN_STATE, state) ||
 	    nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) ||
 	    nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) ||
-- 
1.8.4.rc3


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

* [PATCH 3/3] can: dev: remove do_get_state() callback from struct can_priv
  2013-10-07 14:46 [PATCH 0/3] remove do_get_state() callback Marc Kleine-Budde
  2013-10-07 14:46 ` [PATCH 1/3] can: ti_hecc: remove priv->can.do_get_state() callback Marc Kleine-Budde
  2013-10-07 14:46 ` [PATCH 2/3] can: dev: remove do_get_state() form can_fill_info() Marc Kleine-Budde
@ 2013-10-07 14:46 ` Marc Kleine-Budde
  2013-10-07 19:25 ` [PATCH 0/3] remove do_get_state() callback Wolfgang Grandegger
  3 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-10-07 14:46 UTC (permalink / raw)
  To: linux-can; +Cc: kernel, Marc Kleine-Budde

As there are no users of the do_get_state() callback it is removed from the
struct can_priv.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 include/linux/can/dev.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index fb0ab65..b0a429e 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -46,8 +46,6 @@ struct can_priv {
 
 	int (*do_set_bittiming)(struct net_device *dev);
 	int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
-	int (*do_get_state)(const struct net_device *dev,
-			    enum can_state *state);
 	int (*do_get_berr_counter)(const struct net_device *dev,
 				   struct can_berr_counter *bec);
 
-- 
1.8.4.rc3


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

* Re: [PATCH 0/3] remove do_get_state() callback
  2013-10-07 14:46 [PATCH 0/3] remove do_get_state() callback Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2013-10-07 14:46 ` [PATCH 3/3] can: dev: remove do_get_state() callback from struct can_priv Marc Kleine-Budde
@ 2013-10-07 19:25 ` Wolfgang Grandegger
  2013-10-07 19:39   ` Marc Kleine-Budde
  3 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Grandegger @ 2013-10-07 19:25 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can; +Cc: kernel

On 10/07/2013 04:46 PM, Marc Kleine-Budde wrote:
> Hello,
> 
> this patch series removes the do_get_state() callback from the driver
> interface, as it is not needed to get the state of the interface.

I just realized that Max's GS-USB driver would require it because the
device does not send asynchronous error and state change messages. But
thinking more about it, I tend to nack such a solution as it breaks many
user space programs.

Wolfgang.



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

* Re: [PATCH 0/3] remove do_get_state() callback
  2013-10-07 19:25 ` [PATCH 0/3] remove do_get_state() callback Wolfgang Grandegger
@ 2013-10-07 19:39   ` Marc Kleine-Budde
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2013-10-07 19:39 UTC (permalink / raw)
  To: Wolfgang Grandegger; +Cc: linux-can, kernel

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

On 10/07/2013 09:25 PM, Wolfgang Grandegger wrote:
>> this patch series removes the do_get_state() callback from the driver
>> interface, as it is not needed to get the state of the interface.

Then I'll just take "[PATCH 1/3] can: ti_hecc: remove
priv->can.do_get_state() callback"

> I just realized that Max's GS-USB driver would require it because the
> device does not send asynchronous error and state change messages. But
> thinking more about it, I tend to nack such a solution as it breaks many
> user space programs.

The real need for a synchronous state callback to the driver has come
with the GS-USB device. I'll drop patches 2+3.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

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

end of thread, other threads:[~2013-10-07 19:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-07 14:46 [PATCH 0/3] remove do_get_state() callback Marc Kleine-Budde
2013-10-07 14:46 ` [PATCH 1/3] can: ti_hecc: remove priv->can.do_get_state() callback Marc Kleine-Budde
2013-10-07 14:46 ` [PATCH 2/3] can: dev: remove do_get_state() form can_fill_info() Marc Kleine-Budde
2013-10-07 14:46 ` [PATCH 3/3] can: dev: remove do_get_state() callback from struct can_priv Marc Kleine-Budde
2013-10-07 19:25 ` [PATCH 0/3] remove do_get_state() callback Wolfgang Grandegger
2013-10-07 19:39   ` Marc Kleine-Budde

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