OMAP3: SR: Remove redundant defines
[linux-ginger.git] / drivers / staging / rt3090 / rt_profile.c
blob49a05901bad4b53442307a954d47a1951763ff72
1 /*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 * *
25 *************************************************************************
27 Module Name:
28 rt_profile.c
30 Abstract:
32 Revision History:
33 Who When What
34 --------- ---------- ----------------------------------------------
37 #include "rt_config.h"
40 NDIS_STATUS RTMPReadParametersHook(
41 IN PRTMP_ADAPTER pAd)
43 PSTRING src = NULL;
44 RTMP_OS_FD srcf;
45 RTMP_OS_FS_INFO osFSInfo;
46 INT retval = NDIS_STATUS_FAILURE;
47 PSTRING buffer;
49 buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG);
50 if(buffer == NULL)
51 return NDIS_STATUS_FAILURE;
52 memset(buffer, 0x00, MAX_INI_BUFFER_SIZE);
56 #ifdef CONFIG_STA_SUPPORT
57 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
59 src = STA_PROFILE_PATH;
61 #endif // CONFIG_STA_SUPPORT //
62 #ifdef MULTIPLE_CARD_SUPPORT
63 src = (PSTRING)pAd->MC_FileName;
64 #endif // MULTIPLE_CARD_SUPPORT //
67 if (src && *src)
69 RtmpOSFSInfoChange(&osFSInfo, TRUE);
70 srcf = RtmpOSFileOpen(src, O_RDONLY, 0);
71 if (IS_FILE_OPEN_ERR(srcf))
73 DBGPRINT(RT_DEBUG_ERROR, ("Open file \"%s\" failed!\n", src));
75 else
77 retval =RtmpOSFileRead(srcf, buffer, MAX_INI_BUFFER_SIZE);
78 if (retval > 0)
80 RTMPSetProfileParameters(pAd, buffer);
81 retval = NDIS_STATUS_SUCCESS;
83 else
84 DBGPRINT(RT_DEBUG_ERROR, ("Read file \"%s\" failed(errCode=%d)!\n", src, retval));
86 retval = RtmpOSFileClose(srcf);
87 if ( retval != 0)
89 retval = NDIS_STATUS_FAILURE;
90 DBGPRINT(RT_DEBUG_ERROR, ("Close file \"%s\" failed(errCode=%d)!\n", src, retval));
94 RtmpOSFSInfoChange(&osFSInfo, FALSE);
97 kfree(buffer);
99 return (retval);