aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/caif
diff options
context:
space:
mode:
authorSjur Brændeland <sjur.brandeland@stericsson.com>2012-06-25 03:49:42 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-25 19:44:12 -0400
commit1c385f1fdf6f9c66d982802cd74349c040980b50 (patch)
tree4ee155d06717be94581d404d04c7c6898d1fa360 /drivers/net/caif
parentc41254006377842013922fb1e407391f24c59522 (diff)
caif-hsi: Replace platform device with ops structure.
Remove use of struct platform_device, and replace it with struct cfhsi_ops. Updated variable names in the same spirit: cfhsi_get_dev to cfhsi_get_ops, cfhsi->dev to cfhsi->ops and, cfhsi->dev.drv to cfhsi->ops->cb_ops. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/caif')
-rw-r--r--drivers/net/caif/caif_hsi.c109
1 files changed, 51 insertions, 58 deletions
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c
index a14f85c0f0e8..0927c108bd14 100644
--- a/drivers/net/caif/caif_hsi.c
+++ b/drivers/net/caif/caif_hsi.c
@@ -11,7 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/platform_device.h>
15#include <linux/netdevice.h> 14#include <linux/netdevice.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/list.h> 16#include <linux/list.h>
@@ -184,7 +183,7 @@ static int cfhsi_flush_fifo(struct cfhsi *cfhsi)
184 __func__); 183 __func__);
185 184
186 do { 185 do {
187 ret = cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, 186 ret = cfhsi->ops->cfhsi_fifo_occupancy(cfhsi->ops,
188 &fifo_occupancy); 187 &fifo_occupancy);
189 if (ret) { 188 if (ret) {
190 netdev_warn(cfhsi->ndev, 189 netdev_warn(cfhsi->ndev,
@@ -197,8 +196,8 @@ static int cfhsi_flush_fifo(struct cfhsi *cfhsi)
197 196
198 fifo_occupancy = min(sizeof(buffer), fifo_occupancy); 197 fifo_occupancy = min(sizeof(buffer), fifo_occupancy);
199 set_bit(CFHSI_FLUSH_FIFO, &cfhsi->bits); 198 set_bit(CFHSI_FLUSH_FIFO, &cfhsi->bits);
200 ret = cfhsi->dev->cfhsi_rx(buffer, fifo_occupancy, 199 ret = cfhsi->ops->cfhsi_rx(buffer, fifo_occupancy,
201 cfhsi->dev); 200 cfhsi->ops);
202 if (ret) { 201 if (ret) {
203 clear_bit(CFHSI_FLUSH_FIFO, &cfhsi->bits); 202 clear_bit(CFHSI_FLUSH_FIFO, &cfhsi->bits);
204 netdev_warn(cfhsi->ndev, 203 netdev_warn(cfhsi->ndev,
@@ -371,7 +370,7 @@ static void cfhsi_start_tx(struct cfhsi *cfhsi)
371 } 370 }
372 371
373 /* Set up new transfer. */ 372 /* Set up new transfer. */
374 res = cfhsi->dev->cfhsi_tx(cfhsi->tx_buf, len, cfhsi->dev); 373 res = cfhsi->ops->cfhsi_tx(cfhsi->tx_buf, len, cfhsi->ops);
375 if (WARN_ON(res < 0)) 374 if (WARN_ON(res < 0))
376 netdev_err(cfhsi->ndev, "%s: TX error %d.\n", 375 netdev_err(cfhsi->ndev, "%s: TX error %d.\n",
377 __func__, res); 376 __func__, res);
@@ -410,11 +409,11 @@ static void cfhsi_tx_done(struct cfhsi *cfhsi)
410 return; 409 return;
411} 410}
412 411
413static void cfhsi_tx_done_cb(struct cfhsi_drv *drv) 412static void cfhsi_tx_done_cb(struct cfhsi_cb_ops *cb_ops)
414{ 413{
415 struct cfhsi *cfhsi; 414 struct cfhsi *cfhsi;
416 415
417 cfhsi = container_of(drv, struct cfhsi, drv); 416 cfhsi = container_of(cb_ops, struct cfhsi, cb_ops);
418 netdev_dbg(cfhsi->ndev, "%s.\n", 417 netdev_dbg(cfhsi->ndev, "%s.\n",
419 __func__); 418 __func__);
420 419
@@ -476,8 +475,8 @@ static int cfhsi_rx_desc(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
476 skb->dev = cfhsi->ndev; 475 skb->dev = cfhsi->ndev;
477 476
478 /* 477 /*
479 * We are called from a arch specific platform device. 478 * We are in a callback handler and
480 * Unfortunately we don't know what context we're 479 * unfortunately we don't know what context we're
481 * running in. 480 * running in.
482 */ 481 */
483 if (in_interrupt()) 482 if (in_interrupt())
@@ -607,7 +606,7 @@ static int cfhsi_rx_pld(struct cfhsi_desc *desc, struct cfhsi *cfhsi)
607 skb->dev = cfhsi->ndev; 606 skb->dev = cfhsi->ndev;
608 607
609 /* 608 /*
610 * We're called from a platform device, 609 * We're called in callback from HSI
611 * and don't know the context we're running in. 610 * and don't know the context we're running in.
612 */ 611 */
613 if (in_interrupt()) 612 if (in_interrupt())
@@ -711,8 +710,8 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi)
711 netdev_dbg(cfhsi->ndev, "%s: Start RX.\n", 710 netdev_dbg(cfhsi->ndev, "%s: Start RX.\n",
712 __func__); 711 __func__);
713 712
714 res = cfhsi->dev->cfhsi_rx(rx_ptr, rx_len, 713 res = cfhsi->ops->cfhsi_rx(rx_ptr, rx_len,
715 cfhsi->dev); 714 cfhsi->ops);
716 if (WARN_ON(res < 0)) { 715 if (WARN_ON(res < 0)) {
717 netdev_err(cfhsi->ndev, "%s: RX error %d.\n", 716 netdev_err(cfhsi->ndev, "%s: RX error %d.\n",
718 __func__, res); 717 __func__, res);
@@ -765,11 +764,11 @@ static void cfhsi_rx_slowpath(unsigned long arg)
765 cfhsi_rx_done(cfhsi); 764 cfhsi_rx_done(cfhsi);
766} 765}
767 766
768static void cfhsi_rx_done_cb(struct cfhsi_drv *drv) 767static void cfhsi_rx_done_cb(struct cfhsi_cb_ops *cb_ops)
769{ 768{
770 struct cfhsi *cfhsi; 769 struct cfhsi *cfhsi;
771 770
772 cfhsi = container_of(drv, struct cfhsi, drv); 771 cfhsi = container_of(cb_ops, struct cfhsi, cb_ops);
773 netdev_dbg(cfhsi->ndev, "%s.\n", 772 netdev_dbg(cfhsi->ndev, "%s.\n",
774 __func__); 773 __func__);
775 774
@@ -803,7 +802,7 @@ static void cfhsi_wake_up(struct work_struct *work)
803 } 802 }
804 803
805 /* Activate wake line. */ 804 /* Activate wake line. */
806 cfhsi->dev->cfhsi_wake_up(cfhsi->dev); 805 cfhsi->ops->cfhsi_wake_up(cfhsi->ops);
807 806
808 netdev_dbg(cfhsi->ndev, "%s: Start waiting.\n", 807 netdev_dbg(cfhsi->ndev, "%s: Start waiting.\n",
809 __func__); 808 __func__);
@@ -819,7 +818,7 @@ static void cfhsi_wake_up(struct work_struct *work)
819 __func__, ret); 818 __func__, ret);
820 819
821 clear_bit(CFHSI_WAKE_UP, &cfhsi->bits); 820 clear_bit(CFHSI_WAKE_UP, &cfhsi->bits);
822 cfhsi->dev->cfhsi_wake_down(cfhsi->dev); 821 cfhsi->ops->cfhsi_wake_down(cfhsi->ops);
823 return; 822 return;
824 } else if (!ret) { 823 } else if (!ret) {
825 bool ca_wake = false; 824 bool ca_wake = false;
@@ -830,14 +829,14 @@ static void cfhsi_wake_up(struct work_struct *work)
830 __func__); 829 __func__);
831 830
832 /* Check FIFO to check if modem has sent something. */ 831 /* Check FIFO to check if modem has sent something. */
833 WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, 832 WARN_ON(cfhsi->ops->cfhsi_fifo_occupancy(cfhsi->ops,
834 &fifo_occupancy)); 833 &fifo_occupancy));
835 834
836 netdev_dbg(cfhsi->ndev, "%s: Bytes in FIFO: %u.\n", 835 netdev_dbg(cfhsi->ndev, "%s: Bytes in FIFO: %u.\n",
837 __func__, (unsigned) fifo_occupancy); 836 __func__, (unsigned) fifo_occupancy);
838 837
839 /* Check if we misssed the interrupt. */ 838 /* Check if we misssed the interrupt. */
840 WARN_ON(cfhsi->dev->cfhsi_get_peer_wake(cfhsi->dev, 839 WARN_ON(cfhsi->ops->cfhsi_get_peer_wake(cfhsi->ops,
841 &ca_wake)); 840 &ca_wake));
842 841
843 if (ca_wake) { 842 if (ca_wake) {
@@ -852,7 +851,7 @@ static void cfhsi_wake_up(struct work_struct *work)
852 } 851 }
853 852
854 clear_bit(CFHSI_WAKE_UP, &cfhsi->bits); 853 clear_bit(CFHSI_WAKE_UP, &cfhsi->bits);
855 cfhsi->dev->cfhsi_wake_down(cfhsi->dev); 854 cfhsi->ops->cfhsi_wake_down(cfhsi->ops);
856 return; 855 return;
857 } 856 }
858wake_ack: 857wake_ack:
@@ -865,7 +864,7 @@ wake_ack:
865 864
866 /* Resume read operation. */ 865 /* Resume read operation. */
867 netdev_dbg(cfhsi->ndev, "%s: Start RX.\n", __func__); 866 netdev_dbg(cfhsi->ndev, "%s: Start RX.\n", __func__);
868 res = cfhsi->dev->cfhsi_rx(cfhsi->rx_ptr, cfhsi->rx_len, cfhsi->dev); 867 res = cfhsi->ops->cfhsi_rx(cfhsi->rx_ptr, cfhsi->rx_len, cfhsi->ops);
869 868
870 if (WARN_ON(res < 0)) 869 if (WARN_ON(res < 0))
871 netdev_err(cfhsi->ndev, "%s: RX err %d.\n", __func__, res); 870 netdev_err(cfhsi->ndev, "%s: RX err %d.\n", __func__, res);
@@ -896,7 +895,7 @@ wake_ack:
896 895
897 if (likely(len > 0)) { 896 if (likely(len > 0)) {
898 /* Set up new transfer. */ 897 /* Set up new transfer. */
899 res = cfhsi->dev->cfhsi_tx(cfhsi->tx_buf, len, cfhsi->dev); 898 res = cfhsi->ops->cfhsi_tx(cfhsi->tx_buf, len, cfhsi->ops);
900 if (WARN_ON(res < 0)) { 899 if (WARN_ON(res < 0)) {
901 netdev_err(cfhsi->ndev, "%s: TX error %d.\n", 900 netdev_err(cfhsi->ndev, "%s: TX error %d.\n",
902 __func__, res); 901 __func__, res);
@@ -923,7 +922,7 @@ static void cfhsi_wake_down(struct work_struct *work)
923 return; 922 return;
924 923
925 /* Deactivate wake line. */ 924 /* Deactivate wake line. */
926 cfhsi->dev->cfhsi_wake_down(cfhsi->dev); 925 cfhsi->ops->cfhsi_wake_down(cfhsi->ops);
927 926
928 /* Wait for acknowledge. */ 927 /* Wait for acknowledge. */
929 ret = CFHSI_WAKE_TOUT; 928 ret = CFHSI_WAKE_TOUT;
@@ -942,7 +941,7 @@ static void cfhsi_wake_down(struct work_struct *work)
942 netdev_err(cfhsi->ndev, "%s: Timeout.\n", __func__); 941 netdev_err(cfhsi->ndev, "%s: Timeout.\n", __func__);
943 942
944 /* Check if we misssed the interrupt. */ 943 /* Check if we misssed the interrupt. */
945 WARN_ON(cfhsi->dev->cfhsi_get_peer_wake(cfhsi->dev, 944 WARN_ON(cfhsi->ops->cfhsi_get_peer_wake(cfhsi->ops,
946 &ca_wake)); 945 &ca_wake));
947 if (!ca_wake) 946 if (!ca_wake)
948 netdev_err(cfhsi->ndev, "%s: CA Wake missed !.\n", 947 netdev_err(cfhsi->ndev, "%s: CA Wake missed !.\n",
@@ -951,7 +950,7 @@ static void cfhsi_wake_down(struct work_struct *work)
951 950
952 /* Check FIFO occupancy. */ 951 /* Check FIFO occupancy. */
953 while (retry) { 952 while (retry) {
954 WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, 953 WARN_ON(cfhsi->ops->cfhsi_fifo_occupancy(cfhsi->ops,
955 &fifo_occupancy)); 954 &fifo_occupancy));
956 955
957 if (!fifo_occupancy) 956 if (!fifo_occupancy)
@@ -969,8 +968,7 @@ static void cfhsi_wake_down(struct work_struct *work)
969 clear_bit(CFHSI_AWAKE, &cfhsi->bits); 968 clear_bit(CFHSI_AWAKE, &cfhsi->bits);
970 969
971 /* Cancel pending RX requests. */ 970 /* Cancel pending RX requests. */
972 cfhsi->dev->cfhsi_rx_cancel(cfhsi->dev); 971 cfhsi->ops->cfhsi_rx_cancel(cfhsi->ops);
973
974} 972}
975 973
976static void cfhsi_out_of_sync(struct work_struct *work) 974static void cfhsi_out_of_sync(struct work_struct *work)
@@ -984,11 +982,11 @@ static void cfhsi_out_of_sync(struct work_struct *work)
984 rtnl_unlock(); 982 rtnl_unlock();
985} 983}
986 984
987static void cfhsi_wake_up_cb(struct cfhsi_drv *drv) 985static void cfhsi_wake_up_cb(struct cfhsi_cb_ops *cb_ops)
988{ 986{
989 struct cfhsi *cfhsi = NULL; 987 struct cfhsi *cfhsi = NULL;
990 988
991 cfhsi = container_of(drv, struct cfhsi, drv); 989 cfhsi = container_of(cb_ops, struct cfhsi, cb_ops);
992 netdev_dbg(cfhsi->ndev, "%s.\n", 990 netdev_dbg(cfhsi->ndev, "%s.\n",
993 __func__); 991 __func__);
994 992
@@ -1003,11 +1001,11 @@ static void cfhsi_wake_up_cb(struct cfhsi_drv *drv)
1003 queue_work(cfhsi->wq, &cfhsi->wake_up_work); 1001 queue_work(cfhsi->wq, &cfhsi->wake_up_work);
1004} 1002}
1005 1003
1006static void cfhsi_wake_down_cb(struct cfhsi_drv *drv) 1004static void cfhsi_wake_down_cb(struct cfhsi_cb_ops *cb_ops)
1007{ 1005{
1008 struct cfhsi *cfhsi = NULL; 1006 struct cfhsi *cfhsi = NULL;
1009 1007
1010 cfhsi = container_of(drv, struct cfhsi, drv); 1008 cfhsi = container_of(cb_ops, struct cfhsi, cb_ops);
1011 netdev_dbg(cfhsi->ndev, "%s.\n", 1009 netdev_dbg(cfhsi->ndev, "%s.\n",
1012 __func__); 1010 __func__);
1013 1011
@@ -1110,7 +1108,7 @@ static int cfhsi_xmit(struct sk_buff *skb, struct net_device *dev)
1110 WARN_ON(!len); 1108 WARN_ON(!len);
1111 1109
1112 /* Set up new transfer. */ 1110 /* Set up new transfer. */
1113 res = cfhsi->dev->cfhsi_tx(cfhsi->tx_buf, len, cfhsi->dev); 1111 res = cfhsi->ops->cfhsi_tx(cfhsi->tx_buf, len, cfhsi->ops);
1114 if (WARN_ON(res < 0)) { 1112 if (WARN_ON(res < 0)) {
1115 netdev_err(cfhsi->ndev, "%s: TX error %d.\n", 1113 netdev_err(cfhsi->ndev, "%s: TX error %d.\n",
1116 __func__, res); 1114 __func__, res);
@@ -1125,19 +1123,19 @@ static int cfhsi_xmit(struct sk_buff *skb, struct net_device *dev)
1125 return 0; 1123 return 0;
1126} 1124}
1127 1125
1128static const struct net_device_ops cfhsi_ops; 1126static const struct net_device_ops cfhsi_netdevops;
1129 1127
1130static void cfhsi_setup(struct net_device *dev) 1128static void cfhsi_setup(struct net_device *dev)
1131{ 1129{
1132 int i; 1130 int i;
1133 struct cfhsi *cfhsi = netdev_priv(dev); 1131 struct cfhsi *cfhsi = netdev_priv(dev);
1134 dev->features = 0; 1132 dev->features = 0;
1135 dev->netdev_ops = &cfhsi_ops;
1136 dev->type = ARPHRD_CAIF; 1133 dev->type = ARPHRD_CAIF;
1137 dev->flags = IFF_POINTOPOINT | IFF_NOARP; 1134 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
1138 dev->mtu = CFHSI_MAX_CAIF_FRAME_SZ; 1135 dev->mtu = CFHSI_MAX_CAIF_FRAME_SZ;
1139 dev->tx_queue_len = 0; 1136 dev->tx_queue_len = 0;
1140 dev->destructor = free_netdev; 1137 dev->destructor = free_netdev;
1138 dev->netdev_ops = &cfhsi_netdevops;
1141 for (i = 0; i < CFHSI_PRIO_LAST; ++i) 1139 for (i = 0; i < CFHSI_PRIO_LAST; ++i)
1142 skb_queue_head_init(&cfhsi->qhead[i]); 1140 skb_queue_head_init(&cfhsi->qhead[i]);
1143 cfhsi->cfdev.link_select = CAIF_LINK_HIGH_BANDW; 1141 cfhsi->cfdev.link_select = CAIF_LINK_HIGH_BANDW;
@@ -1213,10 +1211,10 @@ static int cfhsi_open(struct net_device *ndev)
1213 spin_lock_init(&cfhsi->lock); 1211 spin_lock_init(&cfhsi->lock);
1214 1212
1215 /* Set up the driver. */ 1213 /* Set up the driver. */
1216 cfhsi->drv.tx_done_cb = cfhsi_tx_done_cb; 1214 cfhsi->cb_ops.tx_done_cb = cfhsi_tx_done_cb;
1217 cfhsi->drv.rx_done_cb = cfhsi_rx_done_cb; 1215 cfhsi->cb_ops.rx_done_cb = cfhsi_rx_done_cb;
1218 cfhsi->drv.wake_up_cb = cfhsi_wake_up_cb; 1216 cfhsi->cb_ops.wake_up_cb = cfhsi_wake_up_cb;
1219 cfhsi->drv.wake_down_cb = cfhsi_wake_down_cb; 1217 cfhsi->cb_ops.wake_down_cb = cfhsi_wake_down_cb;
1220 1218
1221 /* Initialize the work queues. */ 1219 /* Initialize the work queues. */
1222 INIT_WORK(&cfhsi->wake_up_work, cfhsi_wake_up); 1220 INIT_WORK(&cfhsi->wake_up_work, cfhsi_wake_up);
@@ -1230,7 +1228,7 @@ static int cfhsi_open(struct net_device *ndev)
1230 clear_bit(CFHSI_AWAKE, &cfhsi->bits); 1228 clear_bit(CFHSI_AWAKE, &cfhsi->bits);
1231 1229
1232 /* Create work thread. */ 1230 /* Create work thread. */
1233 cfhsi->wq = create_singlethread_workqueue(cfhsi->pdev->name); 1231 cfhsi->wq = create_singlethread_workqueue(cfhsi->ndev->name);
1234 if (!cfhsi->wq) { 1232 if (!cfhsi->wq) {
1235 netdev_err(cfhsi->ndev, "%s: Failed to create work queue.\n", 1233 netdev_err(cfhsi->ndev, "%s: Failed to create work queue.\n",
1236 __func__); 1234 __func__);
@@ -1257,7 +1255,7 @@ static int cfhsi_open(struct net_device *ndev)
1257 cfhsi->aggregation_timer.function = cfhsi_aggregation_tout; 1255 cfhsi->aggregation_timer.function = cfhsi_aggregation_tout;
1258 1256
1259 /* Activate HSI interface. */ 1257 /* Activate HSI interface. */
1260 res = cfhsi->dev->cfhsi_up(cfhsi->dev); 1258 res = cfhsi->ops->cfhsi_up(cfhsi->ops);
1261 if (res) { 1259 if (res) {
1262 netdev_err(cfhsi->ndev, 1260 netdev_err(cfhsi->ndev,
1263 "%s: can't activate HSI interface: %d.\n", 1261 "%s: can't activate HSI interface: %d.\n",
@@ -1275,7 +1273,7 @@ static int cfhsi_open(struct net_device *ndev)
1275 return res; 1273 return res;
1276 1274
1277 err_net_reg: 1275 err_net_reg:
1278 cfhsi->dev->cfhsi_down(cfhsi->dev); 1276 cfhsi->ops->cfhsi_down(cfhsi->ops);
1279 err_activate: 1277 err_activate:
1280 destroy_workqueue(cfhsi->wq); 1278 destroy_workqueue(cfhsi->wq);
1281 err_create_wq: 1279 err_create_wq:
@@ -1305,7 +1303,7 @@ static int cfhsi_close(struct net_device *ndev)
1305 del_timer_sync(&cfhsi->aggregation_timer); 1303 del_timer_sync(&cfhsi->aggregation_timer);
1306 1304
1307 /* Cancel pending RX request (if any) */ 1305 /* Cancel pending RX request (if any) */
1308 cfhsi->dev->cfhsi_rx_cancel(cfhsi->dev); 1306 cfhsi->ops->cfhsi_rx_cancel(cfhsi->ops);
1309 1307
1310 /* Destroy workqueue */ 1308 /* Destroy workqueue */
1311 destroy_workqueue(cfhsi->wq); 1309 destroy_workqueue(cfhsi->wq);
@@ -1318,7 +1316,7 @@ static int cfhsi_close(struct net_device *ndev)
1318 cfhsi_abort_tx(cfhsi); 1316 cfhsi_abort_tx(cfhsi);
1319 1317
1320 /* Deactivate interface */ 1318 /* Deactivate interface */
1321 cfhsi->dev->cfhsi_down(cfhsi->dev); 1319 cfhsi->ops->cfhsi_down(cfhsi->ops);
1322 1320
1323 /* Free buffers. */ 1321 /* Free buffers. */
1324 kfree(tx_buf); 1322 kfree(tx_buf);
@@ -1335,7 +1333,7 @@ static void cfhsi_uninit(struct net_device *dev)
1335 list_del(&cfhsi->list); 1333 list_del(&cfhsi->list);
1336} 1334}
1337 1335
1338static const struct net_device_ops cfhsi_ops = { 1336static const struct net_device_ops cfhsi_netdevops = {
1339 .ndo_uninit = cfhsi_uninit, 1337 .ndo_uninit = cfhsi_uninit,
1340 .ndo_open = cfhsi_open, 1338 .ndo_open = cfhsi_open,
1341 .ndo_stop = cfhsi_close, 1339 .ndo_stop = cfhsi_close,
@@ -1419,7 +1417,7 @@ static int caif_hsi_newlink(struct net *src_net, struct net_device *dev,
1419 struct nlattr *tb[], struct nlattr *data[]) 1417 struct nlattr *tb[], struct nlattr *data[])
1420{ 1418{
1421 struct cfhsi *cfhsi = NULL; 1419 struct cfhsi *cfhsi = NULL;
1422 struct platform_device *(*get_dev)(void); 1420 struct cfhsi_ops *(*get_ops)(void);
1423 1421
1424 ASSERT_RTNL(); 1422 ASSERT_RTNL();
1425 1423
@@ -1427,36 +1425,31 @@ static int caif_hsi_newlink(struct net *src_net, struct net_device *dev,
1427 cfhsi_netlink_parms(data, cfhsi); 1425 cfhsi_netlink_parms(data, cfhsi);
1428 dev_net_set(cfhsi->ndev, src_net); 1426 dev_net_set(cfhsi->ndev, src_net);
1429 1427
1430 get_dev = symbol_get(cfhsi_get_device); 1428 get_ops = symbol_get(cfhsi_get_ops);
1431 if (!get_dev) { 1429 if (!get_ops) {
1432 pr_err("%s: failed to get the cfhsi device symbol\n", __func__); 1430 pr_err("%s: failed to get the cfhsi_ops\n", __func__);
1433 return -ENODEV; 1431 return -ENODEV;
1434 } 1432 }
1435 1433
1436 /* Assign the HSI device. */ 1434 /* Assign the HSI device. */
1437 cfhsi->pdev = (*get_dev)(); 1435 cfhsi->ops = (*get_ops)();
1438 if (!cfhsi->pdev) { 1436 if (!cfhsi->ops) {
1439 pr_err("%s: failed to get the cfhsi device\n", __func__); 1437 pr_err("%s: failed to get the cfhsi_ops\n", __func__);
1440 goto err; 1438 goto err;
1441 } 1439 }
1442 1440
1443 /* Assign the HSI device. */
1444 cfhsi->dev = cfhsi->pdev->dev.platform_data;
1445
1446 /* Assign the driver to this HSI device. */ 1441 /* Assign the driver to this HSI device. */
1447 cfhsi->dev->drv = &cfhsi->drv; 1442 cfhsi->ops->cb_ops = &cfhsi->cb_ops;
1448
1449 if (register_netdevice(dev)) { 1443 if (register_netdevice(dev)) {
1450 pr_warn("%s: device rtml registration failed\n", __func__); 1444 pr_warn("%s: caif_hsi device registration failed\n", __func__);
1451 goto err; 1445 goto err;
1452
1453 } 1446 }
1454 /* Add CAIF HSI device to list. */ 1447 /* Add CAIF HSI device to list. */
1455 list_add_tail(&cfhsi->list, &cfhsi_list); 1448 list_add_tail(&cfhsi->list, &cfhsi_list);
1456 1449
1457 return 0; 1450 return 0;
1458err: 1451err:
1459 symbol_put(cfhsi_get_device); 1452 symbol_put(cfhsi_get_ops);
1460 return -ENODEV; 1453 return -ENODEV;
1461} 1454}
1462 1455