Clean up whitespace in the example code to be style(9), esp. with regards

to indentation in the functions.
This commit is contained in:
John Baldwin 2003-12-31 18:32:36 +00:00
parent dff04d611f
commit 35704cd4a6
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=19412

View file

@ -43,10 +43,10 @@
#include <dev/pci/pcireg.h> #include <dev/pci/pcireg.h>
/* Function prototypes */ /* Function prototypes */
d_open_t mypci_open; d_open_t mypci_open;
d_close_t mypci_close; d_close_t mypci_close;
d_read_t mypci_read; d_read_t mypci_read;
d_write_t mypci_write; d_write_t mypci_write;
/* Character device entry points */ /* Character device entry points */
@ -67,37 +67,37 @@ static dev_t sdev;
int int
mypci_open(dev_t dev, int oflags, int devtype, d_thread_t *td) mypci_open(dev_t dev, int oflags, int devtype, d_thread_t *td)
{ {
int err = 0; int err = 0;
printf("Opened device \"mypci\" successfully.\n"); printf("Opened device \"mypci\" successfully.\n");
return(err); return (err);
} }
int int
mypci_close(dev_t dev, int fflag, int devtype, struct d_thread_t *td) mypci_close(dev_t dev, int fflag, int devtype, struct d_thread_t *td)
{ {
int err=0; int err = 0;
printf("Closing device \"mypci.\"\n"); printf("Closing device \"mypci.\"\n");
return(err); return (err);
} }
int int
mypci_read(dev_t dev, struct uio *uio, int ioflag) mypci_read(dev_t dev, struct uio *uio, int ioflag)
{ {
int err = 0; int err = 0;
printf("mypci read!\n"); printf("mypci read!\n");
return err; return (err);
} }
int int
mypci_write(dev_t dev, struct uio *uio, int ioflag) mypci_write(dev_t dev, struct uio *uio, int ioflag)
{ {
int err = 0; int err = 0;
printf("mypci write!\n"); printf("mypci write!\n");
return(err); return (err);
} }
/* PCI Support Functions */ /* PCI Support Functions */
@ -108,15 +108,14 @@ mypci_write(dev_t dev, struct uio *uio, int ioflag)
static int static int
mypci_probe(device_t dev) mypci_probe(device_t dev)
{ {
device_printf(dev, "MyPCI Probe\nVendor ID : 0x%x\nDevice ID : 0x%x\n", device_printf(dev, "MyPCI Probe\nVendor ID : 0x%x\nDevice ID : 0x%x\n",
pci_get_vendor(dev), pci_get_device(dev)); pci_get_vendor(dev), pci_get_device(dev));
if (pci_get_vendor(dev) == 0x11c1) { if (pci_get_vendor(dev) == 0x11c1) {
printf("We've got the Winmodem, probe successful!\n"); printf("We've got the Winmodem, probe successful!\n");
return 0; return (0);
} }
return (ENXIO);
return ENXIO;
} }
/* Attach function is only called if the probe is successful */ /* Attach function is only called if the probe is successful */
@ -124,11 +123,12 @@ mypci_probe(device_t dev)
static int static int
mypci_attach(device_t dev) mypci_attach(device_t dev)
{ {
printf("MyPCI Attach for : deviceID : 0x%x\n",pci_get_vendor(dev));
sdev = make_dev(<literal>&</literal>mypci_cdevsw, 0, UID_ROOT, GID_WHEEL, printf("MyPCI Attach for : deviceID : 0x%x\n",pci_get_vendor(dev));
0600, "mypci"); sdev = make_dev(<literal>&</literal>mypci_cdevsw, 0, UID_ROOT,
printf("Mypci device loaded.\n"); GID_WHEEL, 0600, "mypci");
return ENXIO; printf("Mypci device loaded.\n");
return (ENXIO);
} }
/* Detach device. */ /* Detach device. */
@ -136,8 +136,9 @@ mypci_attach(device_t dev)
static int static int
mypci_detach(device_t dev) mypci_detach(device_t dev)
{ {
printf("Mypci detach!\n");
return 0; printf("Mypci detach!\n");
return (0);
} }
/* Called during system shutdown after sync. */ /* Called during system shutdown after sync. */
@ -145,8 +146,9 @@ mypci_detach(device_t dev)
static int static int
mypci_shutdown(device_t dev) mypci_shutdown(device_t dev)
{ {
printf("Mypci shutdown!\n");
return 0; printf("Mypci shutdown!\n");
return (0);
} }
/* /*
@ -155,8 +157,9 @@ mypci_shutdown(device_t dev)
static int static int
mypci_suspend(device_t dev) mypci_suspend(device_t dev)
{ {
printf("Mypci suspend!\n");
return 0; printf("Mypci suspend!\n");
return (0);
} }
/* /*
@ -166,8 +169,9 @@ mypci_suspend(device_t dev)
static int static int
mypci_resume(device_t dev) mypci_resume(device_t dev)
{ {
printf("Mypci resume!\n");
return 0; printf("Mypci resume!\n");
return (0);
} }
static device_method_t mypci_methods[] = { static device_method_t mypci_methods[] = {
@ -192,7 +196,7 @@ static driver_t mypci_driver = {
static devclass_t mypci_devclass; static devclass_t mypci_devclass;
DRIVER_MODULE(mypci, pci, mypci_driver, mypci_devclass, 0, 0);</programlisting> DRIVER_MODULE(mypci, pci, mypci_driver, mypci_devclass, 0, 0);</programlisting>
<para>Additional Resources <para>Additional Resources
<itemizedlist> <itemizedlist>
<listitem><simpara><ulink url="http://www.pcisig.org/">PCI <listitem><simpara><ulink url="http://www.pcisig.org/">PCI