Wed Jan 23 18:04:34 2013 UTC ()
Fix spelling, grammar, typos.


(mbalmer)
diff -r1.108 -r1.109 src/sys/dev/sysmon/sysmon_envsys_events.c

cvs diff -r1.108 -r1.109 src/sys/dev/sysmon/sysmon_envsys_events.c (expand / switch to unified diff)

--- src/sys/dev/sysmon/sysmon_envsys_events.c 2012/12/14 15:33:19 1.108
+++ src/sys/dev/sysmon/sysmon_envsys_events.c 2013/01/23 18:04:33 1.109
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sysmon_envsys_events.c,v 1.108 2012/12/14 15:33:19 pgoyette Exp $ */ 1/* $NetBSD: sysmon_envsys_events.c,v 1.109 2013/01/23 18:04:33 mbalmer Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007, 2008 Juan Romero Pardines. 4 * Copyright (c) 2007, 2008 Juan Romero Pardines.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28/* 28/*
29 * sysmon_envsys(9) events framework. 29 * sysmon_envsys(9) events framework.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.108 2012/12/14 15:33:19 pgoyette Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.109 2013/01/23 18:04:33 mbalmer Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/types.h> 36#include <sys/types.h>
37#include <sys/conf.h> 37#include <sys/conf.h>
38#include <sys/errno.h> 38#include <sys/errno.h>
39#include <sys/kernel.h> 39#include <sys/kernel.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/proc.h> 41#include <sys/proc.h>
42#include <sys/mutex.h> 42#include <sys/mutex.h>
43#include <sys/kmem.h> 43#include <sys/kmem.h>
44#include <sys/callout.h> 44#include <sys/callout.h>
45 45
46#include <dev/sysmon/sysmonvar.h> 46#include <dev/sysmon/sysmonvar.h>
@@ -399,28 +399,28 @@ sme_event_unregister(struct sysmon_envsy @@ -399,28 +399,28 @@ sme_event_unregister(struct sysmon_envsy
399 if (see->see_type == type) { 399 if (see->see_type == type) {
400 found = true; 400 found = true;
401 break; 401 break;
402 } 402 }
403 } 403 }
404 } 404 }
405 405
406 if (!found) { 406 if (!found) {
407 mutex_exit(&sme->sme_mtx); 407 mutex_exit(&sme->sme_mtx);
408 return EINVAL; 408 return EINVAL;
409 } 409 }
410 410
411 /* 411 /*
412 * Wait for the event to finish its work, remove from the list 412 * Wait for the event to finish its work, remove it from the list
413 * and release resouces. 413 * and release resources.
414 */ 414 */
415 while (see->see_flags & SEE_EVENT_WORKING) 415 while (see->see_flags & SEE_EVENT_WORKING)
416 cv_wait(&sme->sme_condvar, &sme->sme_mtx); 416 cv_wait(&sme->sme_condvar, &sme->sme_mtx);
417 417
418 DPRINTF(("%s: removed dev=%s sensor=%s type=%d\n", 418 DPRINTF(("%s: removed dev=%s sensor=%s type=%d\n",
419 __func__, see->see_pes.pes_dvname, sensor, type)); 419 __func__, see->see_pes.pes_dvname, sensor, type));
420 420
421 sme_remove_event(see, sme); 421 sme_remove_event(see, sme);
422 422
423 mutex_exit(&sme->sme_mtx); 423 mutex_exit(&sme->sme_mtx);
424 return 0; 424 return 0;
425} 425}
426 426
@@ -437,28 +437,28 @@ sme_event_unregister_sensor(struct sysmo @@ -437,28 +437,28 @@ sme_event_unregister_sensor(struct sysmo
437 bool found = false; 437 bool found = false;
438 438
439 KASSERT(mutex_owned(&sme->sme_mtx)); 439 KASSERT(mutex_owned(&sme->sme_mtx));
440 LIST_FOREACH(see, &sme->sme_events_list, see_list) { 440 LIST_FOREACH(see, &sme->sme_events_list, see_list) {
441 if (see->see_edata == edata) { 441 if (see->see_edata == edata) {
442 found = true; 442 found = true;
443 break; 443 break;
444 } 444 }
445 } 445 }
446 if (!found) 446 if (!found)
447 return EINVAL; 447 return EINVAL;
448 448
449 /* 449 /*
450 * Wait for the event to finish its work, remove from the list 450 * Wait for the event to finish its work, remove it from the list
451 * and release resouces. 451 * and release resources.
452 */ 452 */
453 while (see->see_flags & SEE_EVENT_WORKING) 453 while (see->see_flags & SEE_EVENT_WORKING)
454 cv_wait(&sme->sme_condvar, &sme->sme_mtx); 454 cv_wait(&sme->sme_condvar, &sme->sme_mtx);
455 455
456 DPRINTF(("%s: removed dev=%s sensor=%s\n", 456 DPRINTF(("%s: removed dev=%s sensor=%s\n",
457 __func__, see->see_pes.pes_dvname, edata->desc)); 457 __func__, see->see_pes.pes_dvname, edata->desc));
458 458
459 sme_remove_event(see, sme); 459 sme_remove_event(see, sme);
460 460
461 return 0; 461 return 0;
462} 462}
463 463
464static void 464static void