public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] 2.6.20-rc1-mm1 pktcdvd: cleanup
@ 2006-12-27 16:37 Thomas Maier
  2006-12-27 20:45 ` Phillip Susi
  2006-12-28  7:21 ` Peter Osterlund
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Maier @ 2006-12-27 16:37 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org; +Cc: akpm@osdl.org, petero2@telia.com

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

Hello,

this is a patch to cleanup some things in the pktcdvd driver for linux 2.6.20:

- update documentation
- use clear_bdi_congested/set_bdi_congested functions directly instead of old wrappers
- removed DECLARE_BUF_AS_STRING macro

Signed-off-by: Thomas Maier <balagi@justmail.de>

[-- Attachment #2: pktcdvd-2.6.20-rc1-mm1.patch --]
[-- Type: application/octet-stream, Size: 5198 bytes --]

diff -urpN linux-2.6.20-rc1-mm1/Documentation/ABI/testing/debugfs-pktcdvd module/Documentation/ABI/testing/debugfs-pktcdvd
--- linux-2.6.20-rc1-mm1/Documentation/ABI/testing/debugfs-pktcdvd	2006-12-25 10:55:12.000000000 +0100
+++ module/Documentation/ABI/testing/debugfs-pktcdvd	2006-12-27 14:49:18.000000000 +0100
@@ -1,6 +1,6 @@
 What:           /debug/pktcdvd/pktcdvd[0-7]
 Date:           Oct. 2006
-KernelVersion:  2.6.19
+KernelVersion:  2.6.20
 Contact:        Thomas Maier <balagi@justmail.de>
 Description:
 
@@ -11,8 +11,7 @@ The pktcdvd module (packet writing drive
 these files in debugfs:
 
 /debug/pktcdvd/pktcdvd[0-7]/
-    info            (0444) Lots of human readable driver
-                           statistics and infos. Multiple lines!
+    info            (0444) Lots of driver statistics and infos.
 
 Example:
 -------
diff -urpN linux-2.6.20-rc1-mm1/Documentation/ABI/testing/sysfs-class-pktcdvd module/Documentation/ABI/testing/sysfs-class-pktcdvd
--- linux-2.6.20-rc1-mm1/Documentation/ABI/testing/sysfs-class-pktcdvd	2006-12-25 10:55:21.000000000 +0100
+++ module/Documentation/ABI/testing/sysfs-class-pktcdvd	2006-12-27 14:49:18.000000000 +0100
@@ -1,6 +1,6 @@
 What:           /sys/class/pktcdvd/
 Date:           Oct. 2006
-KernelVersion:  2.6.19
+KernelVersion:  2.6.20
 Contact:        Thomas Maier <balagi@justmail.de>
 Description:
 
diff -urpN linux-2.6.20-rc1-mm1/Documentation/cdrom/packet-writing.txt module/Documentation/cdrom/packet-writing.txt
--- linux-2.6.20-rc1-mm1/Documentation/cdrom/packet-writing.txt	2006-12-25 10:55:32.000000000 +0100
+++ module/Documentation/cdrom/packet-writing.txt	2006-12-27 14:49:42.000000000 +0100
@@ -93,7 +93,7 @@ Notes
 Using the pktcdvd sysfs interface
 ---------------------------------
 
-Since Linux 2.6.19, the pktcdvd module has a sysfs interface
+Since Linux 2.6.20, the pktcdvd module has a sysfs interface
 and can be controlled by it. For example the "pktcdvd" tool uses
 this interface. (see http://people.freenet.de/BalaGi#pktcdvd )
 
diff -urpN linux-2.6.20-rc1-mm1/drivers/block/pktcdvd.c module/drivers/block/pktcdvd.c
--- linux-2.6.20-rc1-mm1/drivers/block/pktcdvd.c	2006-12-25 10:56:05.000000000 +0100
+++ module/drivers/block/pktcdvd.c	2006-12-27 14:50:54.000000000 +0100
@@ -190,15 +190,6 @@ static struct attribute *kobj_pkt_attrs_
 	NULL
 };
 
-/* declares a char buffer[64] _dbuf, copies data from
- * _b with length _l into it and ensures that _dbuf ends
- * with a \0 character.
- */
-#define DECLARE_BUF_AS_STRING(_dbuf, _b, _l) \
-	char _dbuf[64]; int dlen = (_l) < 0 ? 0 : (_l); \
-	if (dlen >= sizeof(_dbuf)) dlen = sizeof(_dbuf)-1; \
-	memcpy(_dbuf, _b, dlen); _dbuf[dlen] = 0
-
 static ssize_t kobj_pkt_show(struct kobject *kobj,
 			struct attribute *attr, char *data)
 {
@@ -264,9 +255,8 @@ static ssize_t kobj_pkt_store(struct kob
 {
 	struct pktcdvd_device *pd = to_pktcdvdkobj(kobj)->pd;
 	int val;
-	DECLARE_BUF_AS_STRING(dbuf, data, len); /* ensure sscanf scans a string */
 
-	if (strcmp(attr->name, "reset") == 0 && dlen > 0) {
+	if (strcmp(attr->name, "reset") == 0 && len > 0) {
 		pd->stats.pkt_started = 0;
 		pd->stats.pkt_ended = 0;
 		pd->stats.secs_w = 0;
@@ -274,7 +264,7 @@ static ssize_t kobj_pkt_store(struct kob
 		pd->stats.secs_r = 0;
 
 	} else if (strcmp(attr->name, "congestion_off") == 0
-		   && sscanf(dbuf, "%d", &val) == 1) {
+		   && sscanf(data, "%d", &val) == 1) {
 		spin_lock(&pd->lock);
 		pd->write_congestion_off = val;
 		init_write_congestion_marks(&pd->write_congestion_off,
@@ -282,7 +272,7 @@ static ssize_t kobj_pkt_store(struct kob
 		spin_unlock(&pd->lock);
 
 	} else if (strcmp(attr->name, "congestion_on") == 0
-		   && sscanf(dbuf, "%d", &val) == 1) {
+		   && sscanf(data, "%d", &val) == 1) {
 		spin_lock(&pd->lock);
 		pd->write_congestion_on = val;
 		init_write_congestion_marks(&pd->write_congestion_off,
@@ -369,8 +359,7 @@ static ssize_t class_pktcdvd_store_add(s
 					size_t count)
 {
 	unsigned int major, minor;
-	DECLARE_BUF_AS_STRING(dbuf, buf, count);
-	if (sscanf(dbuf, "%u:%u", &major, &minor) == 2) {
+	if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
 		pkt_setup_dev(MKDEV(major, minor), NULL);
 		return count;
 	}
@@ -381,8 +370,7 @@ static ssize_t class_pktcdvd_store_remov
 					size_t count)
 {
 	unsigned int major, minor;
-	DECLARE_BUF_AS_STRING(dbuf, buf, count);
-	if (sscanf(dbuf, "%u:%u", &major, &minor) == 2) {
+	if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
 		pkt_remove_dev(MKDEV(major, minor));
 		return count;
 	}
@@ -1390,7 +1378,7 @@ try_next_bio:
 	 		&& pd->bio_queue_size <= pd->write_congestion_off);
 	spin_unlock(&pd->lock);
 	if (wakeup)
-		blk_clear_queue_congested(pd->disk->queue, WRITE);
+		clear_bdi_congested(&pd->disk->queue->backing_dev_info, WRITE);
 
 	pkt->sleep_time = max(PACKET_WAIT_TIME, 1);
 	pkt_set_state(pkt, PACKET_WAITING_STATE);
@@ -2611,7 +2599,7 @@ static int pkt_make_request(request_queu
 	spin_lock(&pd->lock);
 	if (pd->write_congestion_on > 0
 	    && pd->bio_queue_size >= pd->write_congestion_on) {
-		blk_set_queue_congested(q, WRITE);
+		set_bdi_congested(&q->backing_dev_info, WRITE);
 		do {
 			spin_unlock(&pd->lock);
 			congestion_wait(WRITE, HZ);

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

* Re: [PATCH 1/1] 2.6.20-rc1-mm1 pktcdvd: cleanup
  2006-12-27 16:37 [PATCH 1/1] 2.6.20-rc1-mm1 pktcdvd: cleanup Thomas Maier
@ 2006-12-27 20:45 ` Phillip Susi
  2006-12-28  7:21 ` Peter Osterlund
  1 sibling, 0 replies; 3+ messages in thread
From: Phillip Susi @ 2006-12-27 20:45 UTC (permalink / raw)
  To: balagi; +Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, petero2@telia.com

Please attach patches as inline text, not as a binary file, so that we 
can all read it.

Thomas Maier wrote:
> Hello,
> 
> this is a patch to cleanup some things in the pktcdvd driver for linux 2.6.20:
> 
> - update documentation
> - use clear_bdi_congested/set_bdi_congested functions directly instead of old wrappers
> - removed DECLARE_BUF_AS_STRING macro
> 
> Signed-off-by: Thomas Maier <balagi@justmail.de>


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

* Re: [PATCH 1/1] 2.6.20-rc1-mm1 pktcdvd: cleanup
  2006-12-27 16:37 [PATCH 1/1] 2.6.20-rc1-mm1 pktcdvd: cleanup Thomas Maier
  2006-12-27 20:45 ` Phillip Susi
@ 2006-12-28  7:21 ` Peter Osterlund
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Osterlund @ 2006-12-28  7:21 UTC (permalink / raw)
  To: balagi; +Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, axboe

"Thomas Maier" <balagi@justmail.de> writes:

> this is a patch to cleanup some things in the pktcdvd driver for linux 2.6.20:
> 
> - update documentation
> - removed DECLARE_BUF_AS_STRING macro

This part looks good.

> - use clear_bdi_congested/set_bdi_congested functions directly instead of old wrappers

I'm unsure about this one. What's the point of having the
blk_clear_queue_congested()/blk_set_queue_congested() functions if
they are not supposed to be used?

-- 
Peter Osterlund - petero2@telia.com
http://web.telia.com/~u89404340

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

end of thread, other threads:[~2006-12-28  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-27 16:37 [PATCH 1/1] 2.6.20-rc1-mm1 pktcdvd: cleanup Thomas Maier
2006-12-27 20:45 ` Phillip Susi
2006-12-28  7:21 ` Peter Osterlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox