![]() |
|
|||
0001 /* 0002 * Copyright (C) 2010 Nouveau Project 0003 * 0004 * All Rights Reserved. 0005 * 0006 * Permission is hereby granted, free of charge, to any person obtaining 0007 * a copy of this software and associated documentation files (the 0008 * "Software"), to deal in the Software without restriction, including 0009 * without limitation the rights to use, copy, modify, merge, publish, 0010 * distribute, sublicense, and/or sell copies of the Software, and to 0011 * permit persons to whom the Software is furnished to do so, subject to 0012 * the following conditions: 0013 * 0014 * The above copyright notice and this permission notice (including the 0015 * next paragraph) shall be included in all copies or substantial 0016 * portions of the Software. 0017 * 0018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 0019 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 0020 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 0021 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 0022 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 0023 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 0024 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0025 * 0026 */ 0027 #include <core/enum.h> 0028 0029 const struct nvkm_enum * 0030 nvkm_enum_find(const struct nvkm_enum *en, u32 value) 0031 { 0032 while (en->name) { 0033 if (en->value == value) 0034 return en; 0035 en++; 0036 } 0037 0038 return NULL; 0039 } 0040 0041 void 0042 nvkm_snprintbf(char *data, int size, const struct nvkm_bitfield *bf, u32 value) 0043 { 0044 bool space = false; 0045 while (size >= 1 && bf->name) { 0046 if (value & bf->mask) { 0047 int this = snprintf(data, size, "%s%s", 0048 space ? " " : "", bf->name); 0049 size -= this; 0050 data += this; 0051 space = true; 0052 } 0053 bf++; 0054 } 0055 data[0] = '\0'; 0056 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |