Staging: epl: remove __KERNEL__ checks
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 23 Mar 2009 18:19:28 +0000 (11:19 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 3 Apr 2009 21:54:20 +0000 (14:54 -0700)
We are in the kernel, so these checks are pointless.

Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>
Cc: Ronald Sieber <Ronald.Sieber@systec-electronic.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/epl/Benchmark.h
drivers/staging/epl/EplApiProcessImage.c
drivers/staging/epl/EplSdoUdpu.c
drivers/staging/epl/EplTarget.h
drivers/staging/epl/SharedBuff.c
drivers/staging/epl/global.h

index 634600fff320fdff70643f2250c53e1246cb48e5..4cc01bd12a1a4928fecac0f48b4776cf70284aa3 100644 (file)
@@ -73,9 +73,6 @@
 
 #include "global.h"
 
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
-
-//    #include <linux/config.h>
 #include <linux/kernel.h>
 
 #ifdef CONFIG_COLDFIRE
 #define BENCHMARK_MODULES           0x00000000
 #endif
 
-#else
-    // disable Benchmarking
-#undef BENCHMARK_MODULES
-#define BENCHMARK_MODULES               0x00000000
-#endif
-
 /***************************************************************************/
 /*                                                                         */
 /*                                                                         */
index 4fbb7289e0bfc799f1c3a7772bdafaffb01cf8af..869d97a4bd1c636c52563d5baf5fa6959c39ca87 100644 (file)
 ****************************************************************************/
 
 #include "Epl.h"
-//#include "kernel/EplPdokCal.h"
 
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
-#include <asm/uaccess.h>
-#endif
+#include <linux/uaccess.h>
 
 /***************************************************************************/
 /*                                                                         */
@@ -285,19 +282,11 @@ tEplKernel EplApiProcessImageExchangeIn(tEplApiProcessImage *pPI_p)
        tEplKernel Ret = kEplSuccessful;
 
 #if EPL_API_PROCESS_IMAGE_SIZE_IN > 0
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
        copy_to_user(pPI_p->m_pImage,
                     EplApiProcessImageInstance_g.m_abProcessImageInput,
                     min(pPI_p->m_uiSize,
                         sizeof(EplApiProcessImageInstance_g.
                                m_abProcessImageInput)));
-#else
-       EPL_MEMCPY(pPI_p->m_pImage,
-                  EplApiProcessImageInstance_g.m_abProcessImageInput,
-                  min(pPI_p->m_uiSize,
-                      sizeof(EplApiProcessImageInstance_g.
-                             m_abProcessImageInput)));
-#endif
 #endif
 
        return Ret;
@@ -320,19 +309,11 @@ tEplKernel EplApiProcessImageExchangeOut(tEplApiProcessImage *pPI_p)
        tEplKernel Ret = kEplSuccessful;
 
 #if EPL_API_PROCESS_IMAGE_SIZE_OUT > 0
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
        copy_from_user(EplApiProcessImageInstance_g.m_abProcessImageOutput,
                       pPI_p->m_pImage,
                       min(pPI_p->m_uiSize,
                           sizeof(EplApiProcessImageInstance_g.
                                  m_abProcessImageOutput)));
-#else
-       EPL_MEMCPY(EplApiProcessImageInstance_g.m_abProcessImageOutput,
-                  pPI_p->m_pImage,
-                  min(pPI_p->m_uiSize,
-                      sizeof(EplApiProcessImageInstance_g.
-                             m_abProcessImageOutput)));
-#endif
 #endif
 
        return Ret;
index c6397df904557e0ae158599adbcc85ae4988bfac..293e60fc4de75f5ecafee5a34b277ce17766400d 100644 (file)
 
 #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_SDO_UDP)) != 0)
 
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
 #include "SocketLinuxKernel.h"
 #include <linux/completion.h>
 #include <linux/sched.h>
-#endif
 
 /***************************************************************************/
 /*                                                                         */
@@ -110,12 +108,9 @@ typedef struct {
        tEplSequLayerReceiveCb m_fpSdoAsySeqCb;
        SOCKET m_UdpSocket;
 
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
        struct completion m_CompletionUdpThread;
        int m_ThreadHandle;
        int m_iTerminateThread;
-#endif
-
 } tEplSdoUdpInstance;
 
 //---------------------------------------------------------------------------
@@ -128,9 +123,7 @@ static tEplSdoUdpInstance SdoUdpInstance_g;
 // local function prototypes
 //---------------------------------------------------------------------------
 
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
 static int EplSdoUdpThread(void *pArg_p);
-#endif
 
 /***************************************************************************/
 /*                                                                         */
@@ -214,11 +207,8 @@ tEplKernel EplSdoUdpuAddInstance(tEplSequLayerReceiveCb fpReceiveCb_p)
                goto Exit;
        }
 
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
        init_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
        SdoUdpInstance_g.m_iTerminateThread = 0;
-#endif
-
        SdoUdpInstance_g.m_ThreadHandle = 0;
        SdoUdpInstance_g.m_UdpSocket = INVALID_SOCKET;
 
@@ -254,13 +244,10 @@ tEplKernel EplSdoUdpuDelInstance(void)
 
        if (SdoUdpInstance_g.m_ThreadHandle != 0) {     // listen thread was started
                // close thread
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
                SdoUdpInstance_g.m_iTerminateThread = 1;
                /* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
                send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
                wait_for_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
-#endif
-
                SdoUdpInstance_g.m_ThreadHandle = 0;
        }
 
@@ -307,14 +294,11 @@ tEplKernel EplSdoUdpuConfig(unsigned long ulIpAddr_p, unsigned int uiPort_p)
        if (SdoUdpInstance_g.m_ThreadHandle != 0) {     // listen thread was started
 
                // close old thread
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
                SdoUdpInstance_g.m_iTerminateThread = 1;
                /* kill_proc(SdoUdpInstance_g.m_ThreadHandle, SIGTERM, 1 ); */
                send_sig(SIGTERM, SdoUdpInstance_g.m_ThreadHandle, 1);
                wait_for_completion(&SdoUdpInstance_g.m_CompletionUdpThread);
                SdoUdpInstance_g.m_iTerminateThread = 0;
-#endif
-
                SdoUdpInstance_g.m_ThreadHandle = 0;
        }
 
@@ -349,15 +333,12 @@ tEplKernel EplSdoUdpuConfig(unsigned long ulIpAddr_p, unsigned int uiPort_p)
                goto Exit;
        }
        // create Listen-Thread
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
-
        SdoUdpInstance_g.m_ThreadHandle =
            kernel_thread(EplSdoUdpThread, &SdoUdpInstance_g, CLONE_KERNEL);
        if (SdoUdpInstance_g.m_ThreadHandle == 0) {
                Ret = kEplSdoUdpThreadError;
                goto Exit;
        }
-#endif
 
       Exit:
        return Ret;
@@ -573,13 +554,11 @@ static int EplSdoUdpThread(void *pArg_p)
        unsigned int uiSize;
        tEplSdoConHdl SdoConHdl;
 
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
        pInstance = (tEplSdoUdpInstance *) pArg_p;
        daemonize("EplSdoUdpThread");
        allow_signal(SIGTERM);
 
        for (; pInstance->m_iTerminateThread == 0;)
-#endif
 
        {
                // wait for data
@@ -590,11 +569,9 @@ static int EplSdoUdpThread(void *pArg_p)
                                  0,    // flags
                                  (struct sockaddr *)&RemoteAddr,
                                  (int *)&uiSize);
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
                if (iError == -ERESTARTSYS) {
                        break;
                }
-#endif
                if (iError > 0) {
                        // get handle for higher layer
                        iCount = 0;
@@ -663,10 +640,7 @@ static int EplSdoUdpThread(void *pArg_p)
                }               // end of  if(iError!=SOCKET_ERROR)
        }                       // end of for(;;)
 
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
        complete_and_exit(&SdoUdpInstance_g.m_CompletionUdpThread, 0);
-#endif
-
        return 0;
 }
 
index 6ee8d515942dffefa76626434453cf1bb25a080c..0e6da2105458732640dd1353fa32c792c74020ec 100644 (file)
 // applications needs to use one common library function (e.g. memcpy()). So
 // you can set (or change) it here.
 
-#ifndef __KERNEL__
-#include <stdlib.h>
-#include <stdio.h>
-#else
-//        #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/major.h>
 #include <linux/version.h>
-#endif
 
     //29.11.2004 f.j. sonst ist memcpy und memset unbekannt
 //    #include <string.h>
 #define EPL_MEMCPY(dst,src,siz)     memcpy((void*)(dst),(const void*)(src),(size_t)(siz));
 #define EPL_MEMSET(dst,val,siz)     memset((void*)(dst),(int)(val),(size_t)(siz));
 
-#ifndef __KERNEL__
-#define EPL_MALLOC(siz)             malloc((size_t)(siz))
-#define EPL_FREE(ptr)               free((void *)ptr)
-#else
 #define EPL_MALLOC(siz)             kmalloc((size_t)(siz), GFP_KERNEL)
 #define EPL_FREE(ptr)               kfree((void *)ptr)
-#endif
 
 #ifndef PRINTF0
 #define PRINTF                      TRACE
index b69126cf6a783fb99d6465943625757e61989927..d88afc01e95121373ec4561cb75b0da2032cbe29 100644 (file)
 #include "SharedBuff.h"
 #include "ShbIpc.h"
 
-// d.k. Linux kernel modules needs other header files for memcpy()
-#if (TARGET_SYSTEM == _LINUX_) && defined(__KERNEL__)
 #include <linux/string.h>
 #include <linux/kernel.h>
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
 
 /***************************************************************************/
 /*                                                                         */
index d882f2f527076f814a94174e6ef39d01c4846d4e..a27bde92917d57c0b840d7e46f03d9ff65423038 100644 (file)
@@ -288,15 +288,8 @@ typedef struct {
 //---------------------------------------------------------------------------
 
 #ifndef ASSERT
-#if !defined (__linux__) && !defined (__KERNEL__)
-#include <assert.h>
-#ifndef ASSERT
-#define ASSERT(p)    assert(p)
-#endif
-#else
 #define ASSERT(p)
 #endif
-#endif
 
 //---------------------------------------------------------------------------
 //  SYS TEC extensions