aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ps3/ps3-vuart.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ps3/ps3-vuart.c')
-rw-r--r--drivers/ps3/ps3-vuart.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c
index bb8d5b1eec90..90c097a7a47a 100644
--- a/drivers/ps3/ps3-vuart.c
+++ b/drivers/ps3/ps3-vuart.c
@@ -108,18 +108,18 @@ static struct ps3_vuart_port_priv *to_port_priv(
108struct ports_bmp { 108struct ports_bmp {
109 u64 status; 109 u64 status;
110 u64 unused[3]; 110 u64 unused[3];
111} __attribute__ ((aligned (32))); 111} __attribute__((aligned(32)));
112 112
113#define dump_ports_bmp(_b) _dump_ports_bmp(_b, __func__, __LINE__) 113#define dump_ports_bmp(_b) _dump_ports_bmp(_b, __func__, __LINE__)
114static void __maybe_unused _dump_ports_bmp( 114static void __maybe_unused _dump_ports_bmp(
115 const struct ports_bmp* bmp, const char* func, int line) 115 const struct ports_bmp *bmp, const char *func, int line)
116{ 116{
117 pr_debug("%s:%d: ports_bmp: %016lxh\n", func, line, bmp->status); 117 pr_debug("%s:%d: ports_bmp: %016lxh\n", func, line, bmp->status);
118} 118}
119 119
120#define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__) 120#define dump_port_params(_b) _dump_port_params(_b, __func__, __LINE__)
121static void __maybe_unused _dump_port_params(unsigned int port_number, 121static void __maybe_unused _dump_port_params(unsigned int port_number,
122 const char* func, int line) 122 const char *func, int line)
123{ 123{
124#if defined(DEBUG) 124#if defined(DEBUG)
125 static const char *strings[] = { 125 static const char *strings[] = {
@@ -363,7 +363,7 @@ int ps3_vuart_disable_interrupt_disconnect(struct ps3_system_bus_device *dev)
363 */ 363 */
364 364
365static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev, 365static int ps3_vuart_raw_write(struct ps3_system_bus_device *dev,
366 const void* buf, unsigned int bytes, unsigned long *bytes_written) 366 const void *buf, unsigned int bytes, unsigned long *bytes_written)
367{ 367{
368 int result; 368 int result;
369 struct ps3_vuart_port_priv *priv = to_port_priv(dev); 369 struct ps3_vuart_port_priv *priv = to_port_priv(dev);
@@ -431,7 +431,7 @@ void ps3_vuart_clear_rx_bytes(struct ps3_system_bus_device *dev,
431 int result; 431 int result;
432 struct ps3_vuart_port_priv *priv = to_port_priv(dev); 432 struct ps3_vuart_port_priv *priv = to_port_priv(dev);
433 u64 bytes_waiting; 433 u64 bytes_waiting;
434 void* tmp; 434 void *tmp;
435 435
436 result = ps3_vuart_get_rx_bytes_waiting(dev, &bytes_waiting); 436 result = ps3_vuart_get_rx_bytes_waiting(dev, &bytes_waiting);
437 437
@@ -526,9 +526,8 @@ int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf,
526 526
527 lb = kmalloc(sizeof(struct list_buffer) + bytes, GFP_KERNEL); 527 lb = kmalloc(sizeof(struct list_buffer) + bytes, GFP_KERNEL);
528 528
529 if (!lb) { 529 if (!lb)
530 return -ENOMEM; 530 return -ENOMEM;
531 }
532 531
533 memcpy(lb->data, buf, bytes); 532 memcpy(lb->data, buf, bytes);
534 lb->head = lb->data; 533 lb->head = lb->data;
@@ -878,7 +877,7 @@ static int ps3_vuart_handle_port_interrupt(struct ps3_system_bus_device *dev)
878struct vuart_bus_priv { 877struct vuart_bus_priv {
879 struct ports_bmp *bmp; 878 struct ports_bmp *bmp;
880 unsigned int virq; 879 unsigned int virq;
881 struct semaphore probe_mutex; 880 struct mutex probe_mutex;
882 int use_count; 881 int use_count;
883 struct ps3_system_bus_device *devices[PORT_COUNT]; 882 struct ps3_system_bus_device *devices[PORT_COUNT];
884} static vuart_bus_priv; 883} static vuart_bus_priv;
@@ -926,9 +925,8 @@ static int ps3_vuart_bus_interrupt_get(void)
926 925
927 BUG_ON(vuart_bus_priv.use_count > 2); 926 BUG_ON(vuart_bus_priv.use_count > 2);
928 927
929 if (vuart_bus_priv.use_count != 1) { 928 if (vuart_bus_priv.use_count != 1)
930 return 0; 929 return 0;
931 }
932 930
933 BUG_ON(vuart_bus_priv.bmp); 931 BUG_ON(vuart_bus_priv.bmp);
934 932
@@ -1017,7 +1015,7 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
1017 return -EINVAL; 1015 return -EINVAL;
1018 } 1016 }
1019 1017
1020 down(&vuart_bus_priv.probe_mutex); 1018 mutex_lock(&vuart_bus_priv.probe_mutex);
1021 1019
1022 result = ps3_vuart_bus_interrupt_get(); 1020 result = ps3_vuart_bus_interrupt_get();
1023 1021
@@ -1077,7 +1075,7 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
1077 goto fail_probe; 1075 goto fail_probe;
1078 } 1076 }
1079 1077
1080 up(&vuart_bus_priv.probe_mutex); 1078 mutex_unlock(&vuart_bus_priv.probe_mutex);
1081 1079
1082 return result; 1080 return result;
1083 1081
@@ -1090,7 +1088,7 @@ fail_dev_malloc:
1090fail_busy: 1088fail_busy:
1091 ps3_vuart_bus_interrupt_put(); 1089 ps3_vuart_bus_interrupt_put();
1092fail_setup_interrupt: 1090fail_setup_interrupt:
1093 up(&vuart_bus_priv.probe_mutex); 1091 mutex_unlock(&vuart_bus_priv.probe_mutex);
1094 dev_dbg(&dev->core, "%s:%d: failed\n", __func__, __LINE__); 1092 dev_dbg(&dev->core, "%s:%d: failed\n", __func__, __LINE__);
1095 return result; 1093 return result;
1096} 1094}
@@ -1129,7 +1127,7 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
1129 1127
1130 BUG_ON(!dev); 1128 BUG_ON(!dev);
1131 1129
1132 down(&vuart_bus_priv.probe_mutex); 1130 mutex_lock(&vuart_bus_priv.probe_mutex);
1133 1131
1134 dev_dbg(&dev->core, " -> %s:%d: match_id %d\n", __func__, __LINE__, 1132 dev_dbg(&dev->core, " -> %s:%d: match_id %d\n", __func__, __LINE__,
1135 dev->match_id); 1133 dev->match_id);
@@ -1137,7 +1135,7 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
1137 if (!dev->core.driver) { 1135 if (!dev->core.driver) {
1138 dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__, 1136 dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__,
1139 __LINE__); 1137 __LINE__);
1140 up(&vuart_bus_priv.probe_mutex); 1138 mutex_unlock(&vuart_bus_priv.probe_mutex);
1141 return 0; 1139 return 0;
1142 } 1140 }
1143 1141
@@ -1160,7 +1158,7 @@ static int ps3_vuart_remove(struct ps3_system_bus_device *dev)
1160 priv = NULL; 1158 priv = NULL;
1161 1159
1162 dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__); 1160 dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
1163 up(&vuart_bus_priv.probe_mutex); 1161 mutex_unlock(&vuart_bus_priv.probe_mutex);
1164 return 0; 1162 return 0;
1165} 1163}
1166 1164
@@ -1180,7 +1178,7 @@ static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
1180 1178
1181 BUG_ON(!dev); 1179 BUG_ON(!dev);
1182 1180
1183 down(&vuart_bus_priv.probe_mutex); 1181 mutex_lock(&vuart_bus_priv.probe_mutex);
1184 1182
1185 dev_dbg(&dev->core, " -> %s:%d: match_id %d\n", __func__, __LINE__, 1183 dev_dbg(&dev->core, " -> %s:%d: match_id %d\n", __func__, __LINE__,
1186 dev->match_id); 1184 dev->match_id);
@@ -1188,7 +1186,7 @@ static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
1188 if (!dev->core.driver) { 1186 if (!dev->core.driver) {
1189 dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__, 1187 dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__,
1190 __LINE__); 1188 __LINE__);
1191 up(&vuart_bus_priv.probe_mutex); 1189 mutex_unlock(&vuart_bus_priv.probe_mutex);
1192 return 0; 1190 return 0;
1193 } 1191 }
1194 1192
@@ -1212,7 +1210,7 @@ static int ps3_vuart_shutdown(struct ps3_system_bus_device *dev)
1212 1210
1213 dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__); 1211 dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
1214 1212
1215 up(&vuart_bus_priv.probe_mutex); 1213 mutex_unlock(&vuart_bus_priv.probe_mutex);
1216 return 0; 1214 return 0;
1217} 1215}
1218 1216
@@ -1223,7 +1221,7 @@ static int __init ps3_vuart_bus_init(void)
1223 if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) 1221 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
1224 return -ENODEV; 1222 return -ENODEV;
1225 1223
1226 init_MUTEX(&vuart_bus_priv.probe_mutex); 1224 mutex_init(&vuart_bus_priv.probe_mutex);
1227 1225
1228 return 0; 1226 return 0;
1229} 1227}