[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH] CDI.usb, mempool



From: Max Reitz <max@xxxxxxxxxx>

* Split the CDI.usb function "cdi_usb_driver_init_and_register"
  into an init and a register function, because a driver using the
  new driver registering method (via CDI_DRIVER macros) may not
  register itself
+ mempool as CDI header (has been used in the old USB driver)

Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
 include/cdi/mempool.h |   35 +++++++++++++++++++++++++++++++++++
 include/cdi/usb.h     |   11 +++++++++--
 2 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 include/cdi/mempool.h

diff --git a/include/cdi/mempool.h b/include/cdi/mempool.h
new file mode 100644
index 0000000..83d2ab2
--- /dev/null
+++ b/include/cdi/mempool.h
@@ -0,0 +1,35 @@
+/******************************************************************************
+* Copyright (c) 2009 Kevin Wolf                                              *
+*                                                                            *
+* Permission is hereby granted,  free of charge,  to any  person obtaining a *
+* copy of this software and associated documentation files (the "Software"), *
+* to deal in the Software without restriction,  including without limitation *
+* the rights to use,  copy, modify, merge, publish,  distribute, sublicense, *
+* and/or sell copies  of the  Software,  and to permit  persons to whom  the *
+* Software is furnished to do so, subject to the following conditions:       *
+*                                                                            *
+* The above copyright notice and this permission notice shall be included in *
+* all copies or substantial portions of the Software.                        *
+*                                                                            *
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
+* IMPLIED, INCLUDING  BUT NOT  LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
+* FITNESS FOR A PARTICULAR  PURPOSE AND  NONINFRINGEMENT.  IN NO EVENT SHALL *
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
+* LIABILITY,  WHETHER IN AN ACTION OF CONTRACT,  TORT OR OTHERWISE,  ARISING *
+* FROM,  OUT OF  OR IN CONNECTION  WITH THE  SOFTWARE  OR THE  USE OR  OTHER *
+* DEALINGS IN THE SOFTWARE.                                                  *
+*****************************************************************************/
+
+#ifndef MEMPOOL_H
+#define MEMPOOL_H
+
+#include <stdlib.h>
+#include <stdint.h>
+
+struct mempool;
+
+struct mempool* mempool_create(size_t pool_size, size_t object_size);
+int mempool_get(struct mempool* pool, void** obj, uintptr_t* phys_obj);
+int mempool_put(struct mempool* pool, void* obj);
+
+#endif
diff --git a/include/cdi/usb.h b/include/cdi/usb.h
index df695fa..c4406c7 100644
--- a/include/cdi/usb.h
+++ b/include/cdi/usb.h
@@ -288,11 +288,18 @@ struct cdi_usb_device_pattern {
 void cdi_usb_driver_destroy(struct cdi_usb_driver* driver);
 
 /**
- * Initialisiert und registriert einen USB-Bustreiber beim System
+ * Initialisiert einen USB-Bustreiber
  *
  * @param driver Der Treiber
  */
-void cdi_usb_driver_init_and_register(struct cdi_usb_driver* driver);
+void cdi_usb_driver_init(struct cdi_usb_driver* driver);
+
+/**
+ * Registriert einen USB-Bustreiber beim System
+ *
+ * @param driver Der Treiber
+ */
+void cdi_usb_driver_register(struct cdi_usb_driver* driver);
 
 /**
  * Registriert ein gefundenes USB-Geraet beim Betriebssystem
-- 
1.6.4.2