From: Andrew Morton <[email-masked]>

- printk of sizeof() needs %zd

- coding style fixes

- comment fixes

- 80-col xterm fixes

- remove casts of void*'s.

Cc: Evgeniy Polyakov <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>
---

 drivers/connector/cn_queue.c  |   20 ++-----
 drivers/connector/connector.c |  109 +++++++++++++++++++-----------------------
 2 files changed, 58 insertions(+), 71 deletions(-)

diff -puN drivers/connector/cn_queue.c~connector-warning-fixes drivers/connector/cn_queue.c
--- 25/drivers/connector/cn_queue.c~connector-warning-fixes	2005-05-11 22:22:14.000000000 -0700
+++ 25-akpm/drivers/connector/cn_queue.c	2005-05-11 22:22:14.000000000 -0700
@@ -33,7 +33,7 @@
 
 static void cn_queue_wrapper(void *data)
 {
-	struct cn_callback_entry *cbq = (struct cn_callback_entry *)data;
+	struct cn_callback_entry *cbq = data;
 
 	cbq->cb->callback(cbq->cb->priv);
 
@@ -42,7 +42,8 @@ static void cn_queue_wrapper(void *data)
 	cbq->ddata = NULL;
 }
 
-static struct cn_callback_entry *cn_queue_alloc_callback_entry(struct cn_callback *cb)
+static struct cn_callback_entry *
+cn_queue_alloc_callback_entry(struct cn_callback *cb)
 {
 	struct cn_callback_entry *cbq;
 
@@ -99,9 +100,8 @@ int cn_queue_add_callback(struct cn_queu
 			break;
 		}
 	}
-	if (!found) {
+	if (!found)
 		list_add_tail(&cbq->callback_entry, &dev->queue_list);
-	}
 	spin_unlock_bh(&dev->queue_lock);
 
 	if (found) {
@@ -119,7 +119,7 @@ int cn_queue_add_callback(struct cn_queu
 
 void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id)
 {
-	struct cn_callback_entry *cbq = NULL, *n;
+	struct cn_callback_entry *cbq, *n;
 	int found = 0;
 
 	spin_lock_bh(&dev->queue_lock);
@@ -143,11 +143,8 @@ struct cn_queue_dev *cn_queue_alloc_dev(
 	struct cn_queue_dev *dev;
 
 	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
-	if (!dev) {
-		printk(KERN_ERR "%s: Failed to allocte new struct cn_queue_dev.\n",
-		       name);
+	if (!dev)
 		return NULL;
-	}
 
 	memset(dev, 0, sizeof(*dev));
 
@@ -162,7 +159,6 @@ struct cn_queue_dev *cn_queue_alloc_dev(
 
 	dev->cn_queue = create_workqueue(dev->name);
 	if (!dev->cn_queue) {
-		printk(KERN_ERR "Failed to create %s queue.\n", dev->name);
 		kfree(dev);
 		return NULL;
 	}
@@ -178,9 +174,8 @@ void cn_queue_free_dev(struct cn_queue_d
 	destroy_workqueue(dev->cn_queue);
 
 	spin_lock_bh(&dev->queue_lock);
-	list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry) {
+	list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry)
 		list_del(&cbq->callback_entry);
-	}
 	spin_unlock_bh(&dev->queue_lock);
 
 	while (atomic_read(&dev->refcnt)) {
@@ -192,5 +187,4 @@ void cn_queue_free_dev(struct cn_queue_d
 
 	memset(dev, 0, sizeof(*dev));
 	kfree(dev);
-	dev = NULL;
 }
diff -puN drivers/connector/connector.c~connector-warning-fixes drivers/connector/connector.c
--- 25/drivers/connector/connector.c~connector-warning-fixes	2005-05-11 22:22:14.000000000 -0700
+++ 25-akpm/drivers/connector/connector.c	2005-05-11 22:22:14.000000000 -0700
@@ -59,15 +59,16 @@ int cn_already_initialized = 0;
  *
  * Sequence number is incremented with each message to be sent.
  *
- * If we expect reply to our message,
- * then sequence number in received message MUST be the same as in original message,
- * and acknowledge number MUST be the same + 1.
+ * If we expect reply to our message, then sequence number in received message
+ * MUST be the same as in original message, and acknowledge number MUST be the
+ * same + 1.
  *
- * If we receive message and it's sequence number is not equal to one we are expecting,
- * then it is new message.
- * If we receive message and it's sequence number is the same as one we are expecting,
- * but it's acknowledge is not equal acknowledge number in original message + 1,
- * then it is new message.
+ * If we receive message and it's sequence number is not equal to one we are
+ * expecting, then it is new message.
+ *
+ * If we receive message and it's sequence number is the same as one we are
+ * expecting, but it's acknowledge is not equal acknowledge number in original
+ * message + 1, then it is new message.
  *
  */
 int cn_netlink_send(struct cn_msg *msg, u32 __groups, int gfp_mask)
@@ -99,8 +100,9 @@ int cn_netlink_send(struct cn_msg *msg, 
 			       msg->id.idx, msg->id.val, msg->seq);
 			return -ENODEV;
 		}
-	} else
+	} else {
 		groups = __groups;
+	}
 
 	size = NLMSG_SPACE(sizeof(*msg) + msg->len);
 
@@ -113,7 +115,7 @@ int cn_netlink_send(struct cn_msg *msg, 
 
 	nlh = NLMSG_PUT(skb, 0, msg->seq, NLMSG_DONE, size - sizeof(*nlh));
 
-	data = (struct cn_msg *)NLMSG_DATA(nlh);
+	data = NLMSG_DATA(nlh);
 
 	memcpy(data, msg, sizeof(*data) + msg->len);
 #if 0
@@ -135,9 +137,8 @@ nlmsg_failure:
 /*
  * Callback helper - queues work and setup destructor for given data.
  */
-static int cn_call_callback(struct cn_msg *msg,
-			    void (*destruct_data) (void *),
-			    void *data)
+static int
+cn_call_callback(struct cn_msg *msg, void (*destruct_data) (void *), void *data)
 {
 	struct cn_callback_entry *__cbq;
 	struct cn_dev *dev = &cdev;
@@ -153,16 +154,21 @@ static int cn_call_callback(struct cn_ms
 			 * After the first warning I will fix it quickly,
 			 * but now I think it is impossible. --zbr (2004_04_27).
 			 */
-			if (likely(!test_bit(0, &__cbq->work.pending) && __cbq->ddata == NULL)) {
+			if (likely(!test_bit(0, &__cbq->work.pending) &&
+					__cbq->ddata == NULL)) {
 				__cbq->cb->priv = msg;
 
 				__cbq->ddata = data;
 				__cbq->destruct_data = destruct_data;
 
-				if (queue_work(dev->cbdev->cn_queue, &__cbq->work))
+				if (queue_work(dev->cbdev->cn_queue,
+						&__cbq->work))
 					found = 1;
 			} else {
-				printk("%s: cbq->data=%p, work->pending=%08lx.\n", __func__, __cbq->ddata, __cbq->work.pending);
+				printk("%s: cbq->data=%p, "
+					"work->pending=%08lx\n",
+					__func__, __cbq->ddata,
+					__cbq->work.pending);
 				WARN_ON(1);
 			}
 			break;
@@ -186,7 +192,7 @@ static int __cn_rx_skb(struct sk_buff *s
 	uid = NETLINK_CREDS(skb)->uid;
 	seq = nlh->nlmsg_seq;
 	group = NETLINK_CB((skb)).groups;
-	msg = (struct cn_msg *)NLMSG_DATA(nlh);
+	msg = NLMSG_DATA(nlh);
 
 #if 0
 	printk(KERN_INFO "pid=%u, uid=%u, seq=%u, group=%u.\n",
@@ -196,8 +202,7 @@ static int __cn_rx_skb(struct sk_buff *s
 }
 
 /*
- * Main netlink receiving function -
- * it checks skb and netlink header sizes
+ * Main netlink receiving function - it checks skb and netlink header sizes
  * and calls skb receive helper with shared skb.
  */
 static void cn_rx_skb(struct sk_buff *__skb)
@@ -215,7 +220,8 @@ static void cn_rx_skb(struct sk_buff *__
 	}
 #if 0
 	printk(KERN_INFO
-	       "skb: len=%u, data_len=%u, truesize=%u, proto=%u, cloned=%d, shared=%d.\n",
+	       "skb: len=%u, data_len=%u, truesize=%u, proto=%u, "
+			"cloned=%d, shared=%d.\n",
 	       skb->len, skb->data_len, skb->truesize, skb->protocol,
 	       skb_cloned(skb), skb_shared(skb));
 #endif
@@ -226,8 +232,8 @@ static void cn_rx_skb(struct sk_buff *__
 		    skb->len < nlh->nlmsg_len ||
 		    nlh->nlmsg_len > CONNECTOR_MAX_MSG_SIZE) {
 #if 1
-			printk(KERN_INFO "nlmsg_len=%u, sizeof(*nlh)=%u\n",
-			       nlh->nlmsg_len, sizeof(*nlh));
+			printk(KERN_INFO "nlmsg_len=%u, sizeof(*nlh)=%zu\n",
+				nlh->nlmsg_len, sizeof(*nlh));
 #endif
 			kfree_skb(skb);
 			goto out;
@@ -242,7 +248,7 @@ static void cn_rx_skb(struct sk_buff *__
 			kfree_skb(skb);
 	}
 
-      out:
+out:
 	kfree_skb(__skb);
 }
 
@@ -260,10 +266,8 @@ static void cn_input(struct sock *sk, in
 
 /*
  * Notification routing.
- * Gets id and checks if
- * there are notification request for it's idx and val.
- * If there are such requests notify it's listeners
- * with given notify event.
+ * Gets id and checks if there are notification request for it's idx and val.
+ * If there are such requests notify it's listeners with given notify event.
  */
 static void cn_notify(struct cb_id *id, u32 notify_event)
 {
@@ -298,9 +302,9 @@ static void cn_notify(struct cb_id *id, 
 		if (idx_found && val_found) {
 			struct cn_msg m;
 
-			printk(KERN_INFO
-			       "Notifying group %x with event %u about %x.%x.\n",
-			       ctl->group, notify_event, id->idx, id->val);
+			printk(KERN_INFO "Notifying group %x with event %u "
+				"about %x.%x.\n",
+				ctl->group, notify_event, id->idx, id->val);
 
 			memset(&m, 0, sizeof(m));
 			m.ack = notify_event;
@@ -313,10 +317,8 @@ static void cn_notify(struct cb_id *id, 
 }
 
 /*
- * Callback add routing - adds callback
- * with given ID and name.
- * If there is registered callback with the same
- * ID it will not be added.
+ * Callback add routing - adds callback with given ID and name.
+ * If there is registered callback with the same ID it will not be added.
  *
  * May sleep.
  */
@@ -327,12 +329,8 @@ int cn_add_callback(struct cb_id *id, ch
 	struct cn_callback *cb;
 
 	cb = kmalloc(sizeof(*cb), GFP_KERNEL);
-	if (!cb) {
-		printk(KERN_INFO
-		       "%s: Failed to allocate new struct cn_callback.\n",
-		       dev->cbdev->name);
+	if (!cb)
 		return -ENOMEM;
-	}
 
 	memset(cb, 0, sizeof(*cb));
 
@@ -353,10 +351,8 @@ int cn_add_callback(struct cb_id *id, ch
 }
 
 /*
- * Callback remove routing - removes callback
- * with given ID.
- * If there is no registered callback with given
- * ID nothing happens.
+ * Callback remove routing - removes callback with given ID.
+ * If there is no registered callback with given ID nothing happens.
  *
  * May sleep while waiting for reference counter to become zero.
  */
@@ -386,10 +382,11 @@ static int cn_ctl_msg_equals(struct cn_c
 	if (m1->len != m2->len)
 		return 0;
 
-	if ((m1->idx_notify_num + m1->val_notify_num) * sizeof(*req1) != m1->len) {
-		printk(KERN_ERR
-		       "Notify entry[idx_num=%x, val_num=%x, len=%u] contains garbage. Removing.\n",
-		       m1->idx_notify_num, m1->val_notify_num, m1->len);
+	if ((m1->idx_notify_num + m1->val_notify_num) * sizeof(*req1) !=
+			m1->len) {
+		printk(KERN_ERR "Notify entry[idx_num=%x, val_num=%x, len=%u] "
+			"contains garbage. Removing.\n",
+			m1->idx_notify_num, m1->val_notify_num, m1->len);
 		return 1;
 	}
 
@@ -421,15 +418,15 @@ static int cn_ctl_msg_equals(struct cn_c
  */
 static void cn_callback(void *data)
 {
-	struct cn_msg *msg = (struct cn_msg *)data;
+	struct cn_msg *msg = data;
 	struct cn_ctl_msg *ctl;
 	struct cn_ctl_entry *ent;
 	u32 size;
 
 	if (msg->len < sizeof(*ctl)) {
 		printk(KERN_ERR
-		       "Wrong connector request size %u, must be >= %u.\n",
-		       msg->len, sizeof(*ctl));
+			"Wrong connector request size %u, must be >= %zu.\n",
+			msg->len, sizeof(*ctl));
 		return;
 	}
 
@@ -446,9 +443,9 @@ static void cn_callback(void *data)
 	}
 
 	if (ctl->len + sizeof(*ctl) != msg->len) {
-		printk(KERN_ERR
-		       "Wrong message: msg->len=%u must be equal to inner_len=%u [+%u].\n",
-		       msg->len, ctl->len, sizeof(*ctl));
+		printk(KERN_ERR "Wrong message: msg->len=%u must be equal to "
+			"inner_len=%u [+%zu].\n",
+			msg->len, ctl->len, sizeof(*ctl));
 		return;
 	}
 
@@ -473,12 +470,8 @@ static void cn_callback(void *data)
 	size += sizeof(*ent);
 
 	ent = kmalloc(size, GFP_ATOMIC);
-	if (!ent) {
-		printk(KERN_ERR
-		       "Failed to allocate %d bytes for new notify entry.\n",
-		       size);
+	if (!ent)
 		return;
-	}
 
 	memset(ent, 0, size);
 
_