Clean up whitespace in the example code to be style(9), esp. with regards
to indentation in the functions.
This commit is contained in:
parent
dff04d611f
commit
35704cd4a6
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=19412
1 changed files with 42 additions and 38 deletions
|
@ -43,10 +43,10 @@
|
|||
#include <dev/pci/pcireg.h>
|
||||
|
||||
/* Function prototypes */
|
||||
d_open_t mypci_open;
|
||||
d_close_t mypci_close;
|
||||
d_read_t mypci_read;
|
||||
d_write_t mypci_write;
|
||||
d_open_t mypci_open;
|
||||
d_close_t mypci_close;
|
||||
d_read_t mypci_read;
|
||||
d_write_t mypci_write;
|
||||
|
||||
/* Character device entry points */
|
||||
|
||||
|
@ -67,37 +67,37 @@ static dev_t sdev;
|
|||
int
|
||||
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");
|
||||
return(err);
|
||||
printf("Opened device \"mypci\" successfully.\n");
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
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");
|
||||
return(err);
|
||||
printf("Closing device \"mypci.\"\n");
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
mypci_read(dev_t dev, struct uio *uio, int ioflag)
|
||||
{
|
||||
int err = 0;
|
||||
int err = 0;
|
||||
|
||||
printf("mypci read!\n");
|
||||
return err;
|
||||
printf("mypci read!\n");
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
mypci_write(dev_t dev, struct uio *uio, int ioflag)
|
||||
{
|
||||
int err = 0;
|
||||
int err = 0;
|
||||
|
||||
printf("mypci write!\n");
|
||||
return(err);
|
||||
printf("mypci write!\n");
|
||||
return (err);
|
||||
}
|
||||
|
||||
/* PCI Support Functions */
|
||||
|
@ -108,15 +108,14 @@ mypci_write(dev_t dev, struct uio *uio, int ioflag)
|
|||
static int
|
||||
mypci_probe(device_t dev)
|
||||
{
|
||||
device_printf(dev, "MyPCI Probe\nVendor ID : 0x%x\nDevice ID : 0x%x\n",
|
||||
pci_get_vendor(dev), pci_get_device(dev));
|
||||
device_printf(dev, "MyPCI Probe\nVendor ID : 0x%x\nDevice ID : 0x%x\n",
|
||||
pci_get_vendor(dev), pci_get_device(dev));
|
||||
|
||||
if (pci_get_vendor(dev) == 0x11c1) {
|
||||
printf("We've got the Winmodem, probe successful!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ENXIO;
|
||||
if (pci_get_vendor(dev) == 0x11c1) {
|
||||
printf("We've got the Winmodem, probe successful!\n");
|
||||
return (0);
|
||||
}
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
/* Attach function is only called if the probe is successful */
|
||||
|
@ -124,11 +123,12 @@ mypci_probe(device_t dev)
|
|||
static int
|
||||
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,
|
||||
0600, "mypci");
|
||||
printf("Mypci device loaded.\n");
|
||||
return ENXIO;
|
||||
|
||||
printf("MyPCI Attach for : deviceID : 0x%x\n",pci_get_vendor(dev));
|
||||
sdev = make_dev(<literal>&</literal>mypci_cdevsw, 0, UID_ROOT,
|
||||
GID_WHEEL, 0600, "mypci");
|
||||
printf("Mypci device loaded.\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
/* Detach device. */
|
||||
|
@ -136,8 +136,9 @@ mypci_attach(device_t dev)
|
|||
static int
|
||||
mypci_detach(device_t dev)
|
||||
{
|
||||
printf("Mypci detach!\n");
|
||||
return 0;
|
||||
|
||||
printf("Mypci detach!\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Called during system shutdown after sync. */
|
||||
|
@ -145,8 +146,9 @@ mypci_detach(device_t dev)
|
|||
static int
|
||||
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
|
||||
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
|
||||
mypci_resume(device_t dev)
|
||||
{
|
||||
printf("Mypci resume!\n");
|
||||
return 0;
|
||||
|
||||
printf("Mypci resume!\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
static device_method_t mypci_methods[] = {
|
||||
|
@ -192,7 +196,7 @@ static driver_t mypci_driver = {
|
|||
static devclass_t mypci_devclass;
|
||||
|
||||
DRIVER_MODULE(mypci, pci, mypci_driver, mypci_devclass, 0, 0);</programlisting>
|
||||
|
||||
|
||||
<para>Additional Resources
|
||||
<itemizedlist>
|
||||
<listitem><simpara><ulink url="http://www.pcisig.org/">PCI
|
||||
|
|
Loading…
Reference in a new issue