mdbox: Fixed rebuilding mdbox storage.

mdbox: Fixed rebuilding mdbox storage.

--HG--
branch : HEAD

--- src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
+++ src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
@@ -128,41 +128,17 @@
 	return 0;
 }

-static int rebuild_add_file(struct mdbox_storage_rebuild_context *ctx,
-			    const char *path)
-{
-	struct dbox_file *file;
-	const char *fname, *guid;
+static int rebuild_file_mails(struct mdbox_storage_rebuild_context *ctx,
+			      struct dbox_file *file)
+{
+	const char *guid;
 	struct mdbox_rebuild_msg *rec;
-	uint32_t file_id;
 	uoff_t offset, prev_offset, size;
 	bool last, first, fixed = FALSE;
-	unsigned int len;
-	int ret = 0;
-
-	fname = strrchr(path, '/');
-	i_assert(fname != NULL);
-	fname += strlen(MDBOX_MAIL_FILE_PREFIX) + 1;
-
-	file_id = strtoul(fname, NULL, 10);
-	if (!is_numeric(fname, '\0') || file_id == 0) {
-		len = strlen(fname);
-		if (len > 7 && strcmp(fname + len - 7, ".broken") != 0) {
-			i_warning("dbox rebuild: File name is missing ID: %s",
-				  path);
-		}
-		return 0;
-	}
-
-	/* small optimization: typically files are returned sorted. in that
-	   case we don't need to sort them ourself. */
-	if (file_id < ctx->prev_file_id)
-		ctx->msgs_unsorted = TRUE;
-	ctx->prev_file_id = file_id;
-
-	file = mdbox_file_init(ctx->storage, file_id);
+	int ret;
+
+	dbox_file_seek_rewind(file);
 	prev_offset = 0;
-	dbox_file_seek_rewind(file);
 	while ((ret = dbox_file_seek_next(file, &offset, &last)) >= 0) {
 		if (ret > 0) {
 			if ((ret = dbox_file_metadata_read(file)) < 0)
@@ -203,7 +179,7 @@
 		}

 		rec = p_new(ctx->pool, struct mdbox_rebuild_msg, 1);
-		rec->file_id = file_id;
+		rec->file_id = ctx->prev_file_id;
 		rec->offset = offset;
 		rec->size = file->input->v_offset - offset;
 		mail_generate_guid_128_hash(guid, rec->guid_128);
@@ -217,7 +193,48 @@
 			hash_table_insert(ctx->guid_hash, rec->guid_128, rec);
 		}
 	}
-	if (ret == 0 && !last)
+	if (ret < 0)
+		return -1;
+	else if (ret == 0 && !last)
+		return 0;
+	else
+		return 1;
+}
+
+static int rebuild_add_file(struct mdbox_storage_rebuild_context *ctx,
+			    const char *path)
+{
+	struct dbox_file *file;
+	uint32_t file_id;
+	const char *fname;
+	unsigned int len;
+	bool deleted;
+	int ret = 0;
+
+	fname = strrchr(path, '/');
+	i_assert(fname != NULL);
+	fname += strlen(MDBOX_MAIL_FILE_PREFIX) + 1;
+
+	file_id = strtoul(fname, NULL, 10);
+	if (!is_numeric(fname, '\0') || file_id == 0) {
+		len = strlen(fname);
+		if (len > 7 && strcmp(fname + len - 7, ".broken") != 0) {
+			i_warning("dbox rebuild: File name is missing ID: %s",
+				  path);
+		}
+		return 0;
+	}
+
+	/* small optimization: typically files are returned sorted. in that
+	   case we don't need to sort them ourself. */
+	if (file_id < ctx->prev_file_id)
+		ctx->msgs_unsorted = TRUE;
+	ctx->prev_file_id = file_id;
+
+	file = mdbox_file_init(ctx->storage, file_id);
+	if ((ret = dbox_file_open(file, &deleted)) > 0 && !deleted)
+		ret = rebuild_file_mails(ctx, file);
+	if (ret == 0)
 		i_error("dbox rebuild: Failed to fix file %s", path);
 	dbox_file_unref(&file);
 	return ret < 0 ? -1 : 0;


mtd: mxc_nand: Propagate the error if platform_get_irq() fails

Check the return value from platform_get_irq() and propagate it in the case of
error.

Signed-off-by: Fabio Estevam <679188261afeb60eb822cd934fd7b46a48ddd743@freescale.com>
Signed-off-by: Brian Norris <ac73eed4b8a8c9127255a2696c52b2e7503720b8@gmail.com>


Let --no-resize always override --width.

--- src/imgcat.c
+++ src/imgcat.c
@@ -71,7 +71,7 @@
     determine_terminal_capabilities();

     /* Determine if the image should be resized. */
-    if (options.width >= 1) {
+    if ((options.width >= 1) && (options.should_resize)) {
         /* Use explicitly provided width. */
         width = options.width;
     } else if ((!terminal.isatty) || (!options.should_resize)) {


removing superfluous variable

removing superfluous variable

leftover from patch 62cdd38d41505e6a3752216cb2830dda24cc93c5

--- QuEST/src/CPU/QuEST_cpu.c
+++ QuEST/src/CPU/QuEST_cpu.c
@@ -1833,7 +1833,7 @@
     long long int thisInd00; // this thread's index of |..0..0..> (target qubits = 0)
     long long int thisGlobalInd00; // the global (between all nodes) index of this thread's |..0..0..> state
     long long int ind;   // each thread's iteration of amplitudes to modify
-    int i, t, r, c, g;  // each thread's iteration of amps and targets
+    int i, t, r, c;  // each thread's iteration of amps and targets
     qreal reElem, imElem;  // each thread's iteration of u elements

     // each thread/task will record and modify numTargAmps amplitudes, privately


mtd: nand: remove gotos in `check_create()'

This is a second step in restructuring `check_create()'. When we don't
rely on goto statements for our main functionality, the code will become
a little easier to manipulate.

Signed-off-by: Brian Norris <ac73eed4b8a8c9127255a2696c52b2e7503720b8@gmail.com>
Signed-off-by: Artem Bityutskiy <2f96f8cd3e2780a209d0ab27d1b44624d0019d3f@intel.com>

--- drivers/mtd/nand/nand_bbt.c
+++ drivers/mtd/nand/nand_bbt.c
@@ -875,7 +875,7 @@
  */
 static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr *bd)
 {
-	int i, chips, writeops, chipsel, res;
+	int i, chips, writeops, create, chipsel, res;
 	struct nand_chip *this = mtd->priv;
 	struct nand_bbt_descr *td = this->bbt_td;
 	struct nand_bbt_descr *md = this->bbt_md;
@@ -889,6 +889,7 @@

 	for (i = 0; i < chips; i++) {
 		writeops = 0;
+		create = 0;
 		rd = NULL;
 		rd2 = NULL;
 		/* Per chip or per device? */
@@ -896,8 +897,8 @@
 		/* Mirrored table available? */
 		if (md) {
 			if (td->pages[i] == -1 && md->pages[i] == -1) {
+				create = 1;
 				writeops = 0x03;
-				goto create;
 			} else if (td->pages[i] == -1) {
 				rd = md;
 				td->version[i] = md->version[i];
@@ -921,25 +922,27 @@
 			}
 		} else {
 			if (td->pages[i] == -1) {
+				create = 1;
 				writeops = 0x01;
-				goto create;
+			} else {
+				rd = td;
 			}
-			rd = td;
-		}
-		goto writecheck;
-	create:
-		/* Create the bad block table by scanning the device? */
-		if (!(td->options & NAND_BBT_CREATE))
-			continue;
-
-		/* Create the table in memory by scanning the chip(s) */
-		if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY))
-			create_bbt(mtd, buf, bd, chipsel);
-
-		td->version[i] = 1;
-		if (md)
-			md->version[i] = 1;
-	writecheck:
+		}
+
+		if (create) {
+			/* Create the bad block table by scanning the device? */
+			if (!(td->options & NAND_BBT_CREATE))
+				continue;
+
+			/* Create the table in memory by scanning the chip(s) */
+			if (!(this->bbt_options & NAND_BBT_CREATE_EMPTY))
+				create_bbt(mtd, buf, bd, chipsel);
+
+			td->version[i] = 1;
+			if (md)
+				md->version[i] = 1;
+		}
+
 		/* Read back first? */
 		if (rd)
 			read_abs_bbt(mtd, buf, rd, chipsel);


h264encode: reset IDR poc to 0

h264encode: reset IDR poc to 0

Signed-off-by: Elaine Wang <2fccf4cf2dd4d5a13e595e1da306b18171affdc0@intel.com>

--- test/encode/h264encode.c
+++ test/encode/h264encode.c
@@ -1568,7 +1568,7 @@

     slice_param.slice_alpha_c0_offset_div2 = 2;
     slice_param.slice_beta_offset_div2 = 2;
-    slice_param.pic_order_cnt_lsb = current_frame_display % MaxPicOrderCntLsb;
+    slice_param.pic_order_cnt_lsb = (current_frame_display - current_IDR_display) % MaxPicOrderCntLsb;

     va_status = vaCreateBuffer(va_dpy,context_id,VAEncSliceParameterBufferType,
                                sizeof(slice_param),1,&slice_param,&slice_param_buf);


be2net: convert hdr.timeout in be_cmd_loopback_test() to le32

The current code fails on ppc as hdr.timeout is not being converted
to le32.

Signed-off-by: Sathya Perla <0ca50e07605169a0469d077ed0ffd9b60bbb23f2@serverengines.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/benet/be_cmds.c
+++ drivers/net/benet/be_cmds.c
@@ -1593,7 +1593,7 @@

 	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
 			OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req));
-	req->hdr.timeout = 4;
+	req->hdr.timeout = cpu_to_le32(4);

 	req->pattern = cpu_to_le64(pattern);
 	req->src_port = cpu_to_le32(port_num);


Ospray windows build

Ospray windows build

--- src/Interface/Modules/Render/Ospray/VolumeViewer.h
+++ src/Interface/Modules/Render/Ospray/VolumeViewer.h
@@ -24,6 +24,7 @@
 #include <Interface/qt_include.h>
 #include <string>
 #include <vector>
+#include <Interface/Modules/Render/Ospray/share.h>

 //class TransferFunctionEditor;
 class IsosurfaceEditor;
@@ -32,9 +33,9 @@
 class PreferencesDialog;

 //! OSPRay model and its volumes / geometries
-struct ModelState
-{
-  struct Volume
+struct SCISHARE ModelState
+{
+  struct SCISHARE Volume
   {
     Volume(OSPVolume handle,
            const ospcommon::box3f &boundingBox,
@@ -53,7 +54,7 @@

   using VolumePtr = std::shared_ptr<Volume>;

-  struct Geometry
+  struct SCISHARE Geometry
   {
     Geometry(OSPGeometry handle=NULL) : handle(handle) {}
     OSPGeometry handle;
@@ -90,7 +91,7 @@
   }
 };

-struct OsprayViewerParameters
+struct SCISHARE OsprayViewerParameters
 {
   bool showFrameRate;
   std::string rendererType;
@@ -99,13 +100,13 @@
   std::string writeFramesFilename;
 };

-struct OsprayObjectParameters
+struct SCISHARE OsprayObjectParameters
 {
   std::vector<OSPGeometry> moreObjects;
   ospcommon::box3f presetBoundingBox;
 };

-struct OsprayGUIParameters
+struct SCISHARE OsprayGUIParameters
 {
   int width, height;
   QStatusBar* frameRateWidget;
@@ -115,7 +116,7 @@
   QSlider* directionalLightElevationSlider;
 };

-class VolumeViewer : public QWidget
+class SCISHARE VolumeViewer : public QWidget
 {

 Q_OBJECT


h264encode: refine calculation logic of reference frame setting

Signed-off-by: Elaine Wang <2fccf4cf2dd4d5a13e595e1da306b18171affdc0@intel.com>

--- test/encode/h264encode.c
+++ test/encode/h264encode.c
@@ -70,26 +70,34 @@
 #define BITSTREAM_ALLOCATE_STEPPING     4096

-#define SRC_SURFACE_NUM 16 /* 16 surfaces for source YUV */
-#define REF_SURFACE_NUM 16 /* 16 surfaces for reference */
+#define SURFACE_NUM 16 /* 16 surfaces for source YUV */
+#define SURFACE_NUM 16 /* 16 surfaces for reference */
 static  VADisplay va_dpy;
 static  VAProfile h264_profile;
 static  VAConfigAttrib attrib[VAConfigAttribTypeMax];
 static  VAConfigAttrib config_attrib[VAConfigAttribTypeMax];
 static  int config_attrib_num = 0;
-static  VASurfaceID src_surface[SRC_SURFACE_NUM];
-static  VABufferID coded_buf[SRC_SURFACE_NUM];
-static  VASurfaceID ref_surface[REF_SURFACE_NUM];
+static  VASurfaceID src_surface[SURFACE_NUM];
+static  VABufferID  coded_buf[SURFACE_NUM];
+static  VASurfaceID ref_surface[SURFACE_NUM];
 static  VAConfigID config_id;
 static  VAContextID context_id;
 static  VAEncSequenceParameterBufferH264 seq_param;
 static  VAEncPictureParameterBufferH264 pic_param;
 static  VAEncSliceParameterBufferH264 slice_param;
-static  VAPictureH264 LLastCurrPic={picture_id:VA_INVALID_SURFACE}, LastCurrPic={picture_id:VA_INVALID_SURFACE}, CurrentCurrPic; /* One reference for P and two for B */
-
+static  VAPictureH264 CurrentCurrPic;
+static  VAPictureH264 ReferenceFrames[16], RefPicList0_P[32], RefPicList0_B[32], RefPicList1_B[32];
+
+static  unsigned int MaxFrameNum = (2<<16);
+static  unsigned int MaxPicOrderCntLsb = (2<<8);
+static  unsigned int Log2MaxFrameNum = 16;
+static  unsigned int Log2MaxPicOrderCntLsb = 8;
+
+static  unsigned int num_ref_frames = 2;
+static  unsigned int numShortTerm = 0;
 static  int constraint_set_flag = 0;
 static  int h264_packedheader = 0; /* support pack header? */
-static  int h264_maxref = 3;
+static  int h264_maxref = (1<<16|1);
 static  char *coded_fn = NULL, *srcyuv_fn = NULL, *recyuv_fn = NULL;
 static  FILE *coded_fp = NULL, *srcyuv_fp = NULL, *recyuv_fp = NULL;
 static  unsigned long long srcyuv_frames = 0;
@@ -108,11 +116,11 @@
 static  int intra_idr_period = 60;
 static  int ip_period = 1;
 static  int rc_mode = VA_RC_VBR;
-static  int slice_refoverride = 1; /* use VAEncSliceParameterBufferH264:RefPicList0/1 */
 static  unsigned long long current_frame_encoding = 0;
 static  unsigned long long current_frame_display = 0;
 static  int current_frame_num = 0;
 static  int current_frame_type;
+#define current_slot (current_frame_display % SURFACE_NUM)

 /* thread to save coded data/upload source YUV */
 struct storage_task_t {
@@ -123,12 +131,12 @@
 static  struct storage_task_t *storage_task_header = NULL, *storage_task_tail = NULL;
 #define SRC_SURFACE_IN_ENCODING 0
 #define SRC_SURFACE_IN_STORAGE  1
-static  int srcsurface_status[SRC_SURFACE_NUM];
+static  int srcsurface_status[SURFACE_NUM];
 static  int encode_syncmode = 0;
 static  pthread_mutex_t encode_mutex = PTHREAD_MUTEX_INITIALIZER;
 static  pthread_cond_t  encode_cond = PTHREAD_COND_INITIALIZER;
 static  pthread_t encode_thread;
-
+
 /* for performance profiling */
 static unsigned int UploadPictureTicks=0;
 static unsigned int BeginPictureTicks=0;
@@ -670,7 +678,7 @@
     else if (!strncmp(str, "VBR_CONSTRAINED", 15))
         rc_mode = VA_RC_VBR_CONSTRAINED;
     else {
-        printf("Unknow RC mode\n");
+        printf("Unknown RC mode\n");
         rc_mode = -1;
     }
     return rc_mode;
@@ -691,7 +699,6 @@
     printf("   --initialqp <number>\n");
     printf("   --minqp <number>\n");
     printf("   --rcmode <NONE|CBR|VBR|VCM|CQP|VBR_CONTRAINED>\n");
-    printf("   --refoverride: use VAEncSliceParameterBufferH264 to override reference frames\n");
     printf("   --syncmode: sequentially upload source, encoding, save result, no multi-thread\n");
     printf("   --srcyuv <filename> load YUV from a file\n");
     printf("   --fourcc <NV12|IYUV|I420|YV12> source YUV fourcc\n");
@@ -710,7 +717,6 @@
         {"idr_period", required_argument, NULL, 5 },
         {"ip_period", required_argument, NULL, 6 },
         {"rcmode", required_argument, NULL, 7 },
-        {"refoverride",  required_argument, NULL, 8 },
         {"srcyuv", required_argument, NULL, 9 },
         {"fourcc", required_argument, NULL, 10 },
         {"syncmode", no_argument, NULL, 11 },
@@ -759,9 +765,6 @@
                 exit(1);
             }
             break;
-        case 8:
-            slice_refoverride = atoi(optarg);
-            break;
         case 9:
             srcyuv_fn = strdup(optarg);
             break;
@@ -795,10 +798,9 @@
         exit(0);
     }

-    if (frame_bitrate == 0) {
+    if (frame_bitrate == 0)
         frame_bitrate = frame_width * frame_height * 12 * frame_rate / 50;
-        printf("Set bitrate to %dbps\n", frame_bitrate);
-    }
+
     /* open source file */
     if (srcyuv_fn) {
         srcyuv_fp = fopen(srcyuv_fn,"r");
@@ -1031,7 +1033,7 @@
     /* create source surfaces */
     va_status = vaCreateSurfaces(va_dpy,
                                  VA_RT_FORMAT_YUV420, frame_width, frame_height,
-                                 &src_surface[0], SRC_SURFACE_NUM,
+                                 &src_surface[0], SURFACE_NUM,
                                  NULL, 0);
     CHECK_VASTATUS(va_status, "vaCreateSurfaces");

@@ -1039,27 +1041,27 @@
     va_status = vaCreateSurfaces(
             va_dpy,
             VA_RT_FORMAT_YUV420, frame_width, frame_height,
-            &ref_surface[0], h264_maxref,
+            &ref_surface[0], SURFACE_NUM,
             NULL, 0
             );
     CHECK_VASTATUS(va_status, "vaCreateSurfaces");

-    tmp_surfaceid = calloc(SRC_SURFACE_NUM + h264_maxref, sizeof(VASurfaceID));
-    memcpy(tmp_surfaceid, src_surface, SRC_SURFACE_NUM * sizeof(VASurfaceID));
-    memcpy(tmp_surfaceid + SRC_SURFACE_NUM, ref_surface, h264_maxref * sizeof(VASurfaceID));
+    tmp_surfaceid = calloc(2 * SURFACE_NUM, sizeof(VASurfaceID));
+    memcpy(tmp_surfaceid, src_surface, SURFACE_NUM * sizeof(VASurfaceID));
+    memcpy(tmp_surfaceid + SURFACE_NUM, ref_surface, SURFACE_NUM * sizeof(VASurfaceID));

     /* Create a context for this encode pipe */
     va_status = vaCreateContext(va_dpy, config_id,
                                 frame_width, frame_height,
                                 VA_PROGRESSIVE,
-                                tmp_surfaceid, SRC_SURFACE_NUM + h264_maxref,
+                                tmp_surfaceid, 2 * SURFACE_NUM,
                                 &context_id);
     CHECK_VASTATUS(va_status, "vaCreateContext");
     free(tmp_surfaceid);

     codedbuf_size = (frame_width * frame_height * 400) / (16*16);

-    for (i = 0; i < SRC_SURFACE_NUM; i++) {
+    for (i = 0; i < SURFACE_NUM; i++) {
         /* create coded buffer once for all
          * other VA buffers which won't be used again after vaRenderPicture.
          * so APP can always vaCreateBuffer for every frame
@@ -1074,6 +1076,122 @@
     return 0;
 }

+
+
+#define partition(ref, field, key, ascending)   \
+    while (i <= j) {                            \
+        if (ascending) {                        \
+            while (ref[i].field < key)          \
+                i++;                            \
+            while (ref[j].field > key)          \
+                j--;                            \
+        } else {                                \
+            while (ref[i].field > key)          \
+                i++;                            \
+            while (ref[j].field < key)          \
+                j--;                            \
+        }                                       \
+        if (i <= j) {                           \
+            tmp = ref[i];                       \
+            ref[i] = ref[j];                    \
+            ref[j] = tmp;                       \
+            i++;                                \
+            j--;                                \
+        }                                       \
+    }                                           \
+
+static void sort_one(VAPictureH264 ref[], int left, int right,
+                     int ascending, int frame_idx)
+{
+    int i = left, j = right;
+    unsigned int key;
+    VAPictureH264 tmp;
+
+    if (frame_idx) {
+        key = ref[(left + right) / 2].frame_idx;
+        partition(ref, frame_idx, key, ascending);
+    } else {
+        key = ref[(left + right) / 2].TopFieldOrderCnt;
+        partition(ref, TopFieldOrderCnt, key, ascending);
+    }
+
+    /* recursion */
+    if (left < j)
+        sort_one(ref, left, j, ascending, frame_idx);
+
+    if (i < right)
+        sort_one(ref, i, right, ascending, frame_idx);
+}
+
+static void sort_two(VAPictureH264 ref[], int left, int right, int key, int frame_idx,
+                       int divide_ascending, int list0_ascending, int list1_ascending)
+{
+    int i = left, j = right;
+    VAPictureH264 tmp;
+
+    if (frame_idx) {
+        partition(ref, frame_idx, key, divide_ascending);
+    } else {
+        partition(ref, TopFieldOrderCnt, key, divide_ascending);
+    }
+
+
+    sort_one(ref, left, i-1, list0_ascending, frame_idx);
+    sort_one(ref, j+1, right, list1_ascending, frame_idx);
+}
+
+static int update_ReferenceFrames(void)
+{
+    int i;
+
+    if (current_frame_type == FRAME_B)
+        return 0;
+
+    CurrentCurrPic.flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
+    numShortTerm++;
+    if (numShortTerm > num_ref_frames)
+        numShortTerm = num_ref_frames;
+    for (i=numShortTerm-1; i>0; i--)
+        ReferenceFrames[i] = ReferenceFrames[i-1];
+    ReferenceFrames[0] = CurrentCurrPic;
+
+    if (current_frame_type != FRAME_B)
+        current_frame_num++;
+    if (current_frame_num > MaxFrameNum)
+        current_frame_num = 0;
+
+    return 0;
+}
+
+static int update_RefPicList(void)
+{
+    unsigned int current_poc = CurrentCurrPic.TopFieldOrderCnt;
+
+    if (current_frame_type == FRAME_IDR) {
+        numShortTerm = 0;
+        current_frame_num = 0;
+        return 0;
+    }
+
+    if (current_frame_type == FRAME_P) {
+        memcpy(RefPicList0_P, ReferenceFrames, numShortTerm * sizeof(VAPictureH264));
+        sort_one(RefPicList0_P, 0, numShortTerm-1, 0, 1);
+    }
+
+    if (current_frame_type == FRAME_B) {
+        memcpy(RefPicList0_B, ReferenceFrames, numShortTerm * sizeof(VAPictureH264));
+        sort_two(RefPicList0_B, 0, numShortTerm-1, current_poc, 0,
+                 1, 0, 1);
+
+        memcpy(RefPicList1_B, ReferenceFrames, numShortTerm * sizeof(VAPictureH264));
+        sort_two(RefPicList1_B, 0, numShortTerm-1, current_poc, 0,
+                 0, 1, 0);
+    }
+
+    return 0;
+}
+
+
 static int render_sequence(void)
 {
     VABufferID seq_param_buf, rc_param_buf, render_id[2];
@@ -1090,11 +1208,12 @@
     seq_param.intra_idr_period = intra_idr_period;
     seq_param.ip_period = ip_period;

-    seq_param.max_num_ref_frames = h264_maxref;
+    seq_param.max_num_ref_frames = num_ref_frames;
     seq_param.seq_fields.bits.frame_mbs_only_flag = 1;
     seq_param.time_scale = 900;
     seq_param.num_units_in_tick = 15; /* Tc = num_units_in_tick / time_sacle */
-    seq_param.seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = 2;
+    seq_param.seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = Log2MaxPicOrderCntLsb - 4;
+    seq_param.seq_fields.bits.log2_max_frame_num_minus4 = Log2MaxFrameNum - 4;;
     seq_param.seq_fields.bits.frame_mbs_only_flag = 1;

     va_status = vaCreateBuffer(va_dpy, context_id,
@@ -1127,61 +1246,58 @@
     return 0;
 }

+static unsigned int calc_poc(unsigned int pic_order_cnt_lsb)
+{
+    static unsigned int prevPicOrderCntMsb = 0, prevPicOrderCntLsb = 0;
+    static unsigned int PicOrderCntMsb = 0;
+    unsigned int TopFieldOrderCnt;
+
+    if (current_frame_type == FRAME_IDR)
+        prevPicOrderCntMsb = prevPicOrderCntLsb = 0;
+
+    prevPicOrderCntMsb = PicOrderCntMsb;
+    if ((pic_order_cnt_lsb < prevPicOrderCntLsb) &&
+        ((prevPicOrderCntLsb - pic_order_cnt_lsb) >= (MaxPicOrderCntLsb / 2)))
+        PicOrderCntMsb = prevPicOrderCntMsb + MaxPicOrderCntLsb;
+    else if ((pic_order_cnt_lsb > prevPicOrderCntLsb) &&
+             ((pic_order_cnt_lsb - prevPicOrderCntLsb) > (MaxPicOrderCntLsb / 2)))
+        PicOrderCntMsb = prevPicOrderCntMsb - MaxPicOrderCntLsb;
+    else
+        PicOrderCntMsb = prevPicOrderCntMsb;
+
+    TopFieldOrderCnt = PicOrderCntMsb + pic_order_cnt_lsb;
+
+    return TopFieldOrderCnt;
+}
+
 static int render_picture(void)
 {
     VABufferID pic_param_buf;
     VAStatus va_status;
     int i = 0;

-    /* use frame_num as reference frame index */
-    pic_param.CurrPic.picture_id = ref_surface[current_frame_num % h264_maxref];
-    //pic_param.CurrPic.frame_idx = current_frame_num % h264_maxref;
+    pic_param.CurrPic.picture_id = ref_surface[current_slot];
+    pic_param.CurrPic.frame_idx = current_frame_num;
     pic_param.CurrPic.flags = 0;
-    pic_param.CurrPic.TopFieldOrderCnt = 2 * current_frame_display;
-    pic_param.CurrPic.BottomFieldOrderCnt = 0;
-    if (current_frame_type != FRAME_B)
-        CurrentCurrPic = pic_param.CurrPic; /* save it */
-
-    if (slice_refoverride) {
-        /* always setup all reference frame into encoder */
-        for (i = 0; i < h264_maxref; i++) {
-            pic_param.ReferenceFrames[i].picture_id = ref_surface[i];
-            pic_param.ReferenceFrames[i].frame_idx = i;
-            pic_param.ReferenceFrames[i].flags = 0;
-            if (pic_param.CurrPic.picture_id == pic_param.ReferenceFrames[i].picture_id) {
-                pic_param.ReferenceFrames[i].TopFieldOrderCnt = 2 * current_frame_encoding;
-                //pic_param.ReferenceFrames[i].picture_id = VA_INVALID_SURFACE;
-                //pic_param.ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID;
-            }
-            pic_param.ReferenceFrames[i].BottomFieldOrderCnt = 0;
+    pic_param.CurrPic.TopFieldOrderCnt = calc_poc(current_frame_display % MaxPicOrderCntLsb);
+    pic_param.CurrPic.BottomFieldOrderCnt = pic_param.CurrPic.TopFieldOrderCnt;
+    CurrentCurrPic = pic_param.CurrPic;
+
+    if (getenv("TO_DEL")) {
+        update_RefPicList();
+        memset(pic_param.ReferenceFrames, 1, 16 * sizeof(VAPictureH264));
+        if (current_frame_type == FRAME_P) {
+            pic_param.ReferenceFrames[0] = RefPicList0_P[0];
+        } else if (current_frame_type == FRAME_B) {
+            pic_param.ReferenceFrames[0] = RefPicList0_B[0];
+            pic_param.ReferenceFrames[1] = RefPicList1_B[0];
         }
-    } else  {
-        if (current_frame_type == FRAME_I || current_frame_type == FRAME_IDR)
-            i = 0;
-        else if (current_frame_type == FRAME_P) {
-            pic_param.ReferenceFrames[0] = LastCurrPic;
-            pic_param.ReferenceFrames[0].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
-            i = 1;
-            //#if 0
-            if (LLastCurrPic.picture_id == VA_INVALID_SURFACE)
-                pic_param.ReferenceFrames[1] = LastCurrPic;
-            else
-                pic_param.ReferenceFrames[1] = LLastCurrPic;
-            pic_param.ReferenceFrames[1].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
-            i = 2;
-            //#endif
-        } else if (current_frame_type == FRAME_B) {
-            pic_param.ReferenceFrames[0] = LLastCurrPic;
-            pic_param.ReferenceFrames[0].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
-            pic_param.ReferenceFrames[1] = LastCurrPic;
-            pic_param.ReferenceFrames[1].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
-            i = 2;
+    } else {
+        memcpy(pic_param.ReferenceFrames, ReferenceFrames, numShortTerm*sizeof(VAPictureH264));
+        for (i = numShortTerm; i < SURFACE_NUM; i++) {
+            pic_param.ReferenceFrames[i].picture_id = VA_INVALID_SURFACE;
+            pic_param.ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID;
         }
-    }
-
-    for (; i < REF_SURFACE_NUM; i++) {
-        pic_param.ReferenceFrames[i].picture_id = VA_INVALID_SURFACE;
-        pic_param.ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID;
     }

     pic_param.pic_fields.bits.idr_pic_flag = (current_frame_type == FRAME_IDR);
@@ -1189,9 +1305,7 @@
     pic_param.pic_fields.bits.entropy_coding_mode_flag = 1;
     pic_param.pic_fields.bits.deblocking_filter_control_present_flag = 1;
     pic_param.frame_num = current_frame_num;
-    if (current_frame_type != FRAME_B)
-        current_frame_num++;
-    pic_param.coded_buf = coded_buf[current_frame_display % SRC_SURFACE_NUM];
+    pic_param.coded_buf = coded_buf[current_slot];
     pic_param.last_picture = (current_frame_encoding == frame_count);
     pic_param.pic_init_qp = initial_qp;

@@ -1385,38 +1499,51 @@
     VABufferID slice_param_buf;
     VAStatus va_status;
     int i;
+
+    update_RefPicList();

     /* one frame, one slice */
     slice_param.macroblock_address = 0;
     slice_param.num_macroblocks = frame_width*frame_height/(16*16); /* Measured by MB */
     slice_param.slice_type = (current_frame_type == FRAME_IDR)?2:current_frame_type;
-
-    for (i = 0; i < 32; i++) {
-        slice_param.RefPicList0[i].picture_id = VA_INVALID_SURFACE;
-        slice_param.RefPicList0[i].flags = VA_PICTURE_H264_INVALID;
-        slice_param.RefPicList1[i].picture_id = VA_INVALID_SURFACE;
-        slice_param.RefPicList1[i].flags = VA_PICTURE_H264_INVALID;
-    }
-
-    /* cause issue on some implementation if slice_refoverride = 1 */
-    //slice_param.num_ref_idx_active_override_flag = 1;
-    if (slice_refoverride) {
-        /* set the real reference frame */
-        if (current_frame_type == FRAME_I || current_frame_type == FRAME_IDR) {
-            ;
-        } else if (current_frame_type == FRAME_P) {
-            slice_param.RefPicList0[0] = LastCurrPic;
-            slice_param.RefPicList0[0].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
-        } else if (current_frame_type == FRAME_B) {
-            slice_param.RefPicList0[0] = LLastCurrPic;
-            slice_param.RefPicList0[0].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
-            slice_param.RefPicList1[0] = LastCurrPic;
-            slice_param.RefPicList1[0].flags = VA_PICTURE_H264_SHORT_TERM_REFERENCE;
+    if (current_frame_type == FRAME_I || current_frame_type == FRAME_IDR) {
+        ;
+    } else if (current_frame_type == FRAME_P) {
+        int refpiclist0_max = h264_maxref & 0xffff;
+        memcpy(slice_param.RefPicList0, RefPicList0_P, refpiclist0_max*sizeof(VAPictureH264));
+
+        for (i = refpiclist0_max; i < 32; i++) {
+            slice_param.RefPicList0[i].picture_id = VA_INVALID_SURFACE;
+            slice_param.RefPicList0[i].flags = VA_PICTURE_H264_INVALID;
         }
-    }
+    } else if (current_frame_type == FRAME_B) {
+        int refpiclist0_max = h264_maxref & 0xffff;
+        int refpiclist1_max = (h264_maxref >> 16) & 0xffff;
+
+        memcpy(slice_param.RefPicList0, RefPicList0_B, refpiclist0_max*sizeof(VAPictureH264));
+        for (i = refpiclist0_max; i < 32; i++) {
+            slice_param.RefPicList0[i].picture_id = VA_INVALID_SURFACE;
+            slice_param.RefPicList0[i].flags = VA_PICTURE_H264_INVALID;
+        }
+
+        memcpy(slice_param.RefPicList1, RefPicList1_B, refpiclist1_max*sizeof(VAPictureH264));
+        for (i = refpiclist1_max; i < 32; i++) {
+            slice_param.RefPicList1[i].picture_id = VA_INVALID_SURFACE;
+            slice_param.RefPicList1[i].flags = VA_PICTURE_H264_INVALID;
+        }
+    }
+
+    if (getenv("NOREF")) {
+        for (i = 0; i < 32; i++) {
+            slice_param.RefPicList0[i].picture_id = VA_INVALID_SURFACE;
+            slice_param.RefPicList1[i].picture_id = VA_INVALID_SURFACE;
+        }
+    }
+
+
     slice_param.slice_alpha_c0_offset_div2 = 2;
     slice_param.slice_beta_offset_div2 = 2;
-    slice_param.pic_order_cnt_lsb = current_frame_display % 64;
+    slice_param.pic_order_cnt_lsb = current_frame_display % MaxPicOrderCntLsb;

     va_status = vaCreateBuffer(va_dpy,context_id,VAEncSliceParameterBufferType,
                                sizeof(slice_param),1,&slice_param,&slice_param_buf);
@@ -1429,25 +1556,13 @@
 }

-static int update_reflist(void)
-{
-    if (current_frame_type == FRAME_B)
-        return 0;
-
-    LLastCurrPic = LastCurrPic;
-    LastCurrPic = CurrentCurrPic;
-
-    return 0;
-}
-
-
 static int upload_source_YUV_once_for_all()
 {
     int box_width=8;
     int row_shift=0;
     int i;

-    for (i = 0; i < SRC_SURFACE_NUM; i++) {
+    for (i = 0; i < SURFACE_NUM; i++) {
         printf("\rLoading data into surface %d.....", i);
         upload_surface(va_dpy, src_surface[i], box_width, row_shift, 0);

@@ -1463,8 +1578,8 @@
 static int load_surface(VASurfaceID surface_id, unsigned long long display_order)
 {
     VAImage surface_image;
-    unsigned char *surface_p=NULL, *Y_start=NULL, *U_start=NULL,*V_start=NULL;
-    int Y_pitch=0, U_pitch=0, row, V_pitch;
+    unsigned char *surface_p=NULL, *Y_start=NULL, *U_start=NULL,*V_start=NULL, *uv_ptr;
+    int Y_pitch=0, U_pitch=0, row, V_pitch, uv_size;
     VAStatus va_status;

     if (srcyuv_fp == NULL)
@@ -1524,30 +1639,42 @@
     fseek(srcyuv_fp,
           display_order * frame_width * frame_height * 1.5 + frame_width * frame_height,
           SEEK_SET);
+
+    uv_size = 2 * (frame_width/2) * (frame_height/2);
+    uv_ptr = malloc(uv_size);
+    fread(uv_ptr, uv_size, 1, srcyuv_fp);

     for (row =0; row < surface_image.height/2; row++) {
         unsigned char *U_row = U_start + row * U_pitch;
-        //unsigned char *V_row = V_start + row * V_pitch;
+        unsigned char *u_ptr, *v_ptr;
+        int j;
         switch (surface_image.format.fourcc) {
         case VA_FOURCC_NV12:
-            if (srcyuv_fourcc == VA_FOURCC_NV12)
-                (void)fread(U_row, 1, surface_image.width, srcyuv_fp);
-            else if (srcyuv_fourcc == VA_FOURCC_IYUV) {
-                /* tbd */
+            if (srcyuv_fourcc == VA_FOURCC_NV12) {
+                memcpy(U_row, uv_ptr + row * frame_width, frame_width);
+                break;
+            } else if (srcyuv_fourcc == VA_FOURCC_IYUV) {
+                u_ptr = uv_ptr + row * (frame_width/2);
+                v_ptr = uv_ptr + (frame_width/2) * (frame_height/2) + row * (frame_width/2);
+            } else if (srcyuv_fourcc == VA_FOURCC_YV12) {
+                v_ptr = uv_ptr + row * (frame_height/2);
+                u_ptr = uv_ptr + (frame_width/2) * (frame_height/2) + row * (frame_width/2);
             }
-            break;
+            for(j = 0; j < frame_width/2; j++) {
+                U_row[2*j] = u_ptr[j];
+                U_row[2*j+1] = v_ptr[j];
+            }
+            break;
+        case VA_FOURCC_IYUV:
         case VA_FOURCC_YV12:
-            /* tbd */
-            break;
         case VA_FOURCC_YUY2:
-            // see above. it is set with Y update.
-            break;
         default:
             printf("unsupported fourcc in load_surface\n");
             assert(0);
         }
     }
-
+    free(uv_ptr);
+
     vaUnmapBuffer(va_dpy,surface_image.buf);

     vaDestroyImage(va_dpy,surface_image.image_id);
@@ -1562,13 +1689,13 @@
     VAStatus va_status;
     unsigned int coded_size = 0;

-    va_status = vaMapBuffer(va_dpy,coded_buf[display_order % SRC_SURFACE_NUM],(void **)(&buf_list));
+    va_status = vaMapBuffer(va_dpy,coded_buf[display_order % SURFACE_NUM],(void **)(&buf_list));
     CHECK_VASTATUS(va_status,"vaMapBuffer");
     while (buf_list != NULL) {
         coded_size += fwrite(buf_list->buf, 1, buf_list->size, coded_fp);
         buf_list = (VACodedBufferSegment *) buf_list->next;
     }
-    vaUnmapBuffer(va_dpy,coded_buf[display_order % SRC_SURFACE_NUM]);
+    vaUnmapBuffer(va_dpy,coded_buf[display_order % SURFACE_NUM]);

     printf("\r      "); /* return back to startpoint */
     switch (encode_order % 4) {
@@ -1636,7 +1763,7 @@
         storage_task_tail = tmp;
     }

-    srcsurface_status[display_order % SRC_SURFACE_NUM] = SRC_SURFACE_IN_STORAGE;
+    srcsurface_status[display_order % SURFACE_NUM] = SRC_SURFACE_IN_STORAGE;
     pthread_cond_signal(&encode_cond);

     pthread_mutex_unlock(&encode_mutex);
@@ -1650,7 +1777,7 @@
     VAStatus va_status;

     tmp = GetTickCount();
-    va_status = vaSyncSurface(va_dpy, src_surface[display_order % SRC_SURFACE_NUM]);
+    va_status = vaSyncSurface(va_dpy, src_surface[display_order % SURFACE_NUM]);
     CHECK_VASTATUS(va_status,"vaSyncSurface");
     SyncPictureTicks += GetTickCount() - tmp;
     tmp = GetTickCount();
@@ -1661,11 +1788,11 @@
     /* reload a new frame data */
     tmp = GetTickCount();
     if (srcyuv_fp != NULL)
-        load_surface(src_surface[display_order % SRC_SURFACE_NUM], display_order + SRC_SURFACE_NUM);
+        load_surface(src_surface[display_order % SURFACE_NUM], display_order + SURFACE_NUM);
     UploadPictureTicks += GetTickCount() - tmp;

     pthread_mutex_lock(&encode_mutex);
-    srcsurface_status[display_order % SRC_SURFACE_NUM] = SRC_SURFACE_IN_ENCODING;
+    srcsurface_status[display_order % SURFACE_NUM] = SRC_SURFACE_IN_ENCODING;
     pthread_mutex_unlock(&encode_mutex);
 }

@@ -1705,7 +1832,7 @@
     /* upload RAW YUV data into all surfaces */
     tmp = GetTickCount();
     if (srcyuv_fp != NULL) {
-        for (i = 0; i < SRC_SURFACE_NUM; i++)
+        for (i = 0; i < SURFACE_NUM; i++)
             load_surface(src_surface[i], i);
     } else
         upload_source_YUV_once_for_all();
@@ -1726,10 +1853,10 @@
                                &current_frame_display, &current_frame_type);

         /* check if the source frame is ready */
-        while (srcsurface_status[current_frame_display % SRC_SURFACE_NUM] != SRC_SURFACE_IN_ENCODING);
+        while (srcsurface_status[current_slot] != SRC_SURFACE_IN_ENCODING);

         tmp = GetTickCount();
-        va_status = vaBeginPicture(va_dpy, context_id, src_surface[current_frame_display % SRC_SURFACE_NUM]);
+        va_status = vaBeginPicture(va_dpy, context_id, src_surface[current_slot]);
         CHECK_VASTATUS(va_status,"vaBeginPicture");
         BeginPictureTicks += GetTickCount() - tmp;

@@ -1766,11 +1893,10 @@

         /* how to process skipped frames
            surface_status = (VASurfaceStatus) 0;
-           va_status = vaQuerySurfaceStatus(va_dpy, src_surface[i%SRC_SURFACE_NUM],&surface_status);
+           va_status = vaQuerySurfaceStatus(va_dpy, src_surface[i%SURFACE_NUM],&surface_status);
            frame_skipped = (surface_status & VASurfaceSkipped);
         */
-
-        update_reflist();
+        update_ReferenceFrames();
     }

     if (encode_syncmode == 0) {
@@ -1786,10 +1912,10 @@
 {
     int i;

-    vaDestroySurfaces(va_dpy,&src_surface[0],SRC_SURFACE_NUM);
-    vaDestroySurfaces(va_dpy,&ref_surface[0],h264_maxref);
-
-    for (i = 0; i < SRC_SURFACE_NUM; i++)
+    vaDestroySurfaces(va_dpy,&src_surface[0],SURFACE_NUM);
+    vaDestroySurfaces(va_dpy,&ref_surface[0],SURFACE_NUM);
+
+    for (i = 0; i < SURFACE_NUM; i++)
         vaDestroyBuffer(va_dpy,coded_buf[i]);

     vaDestroyContext(va_dpy,context_id);


[PATCH] chelsio: remove leftover code

[PATCH] chelsio: remove leftover code

The chelsio network driver has some extra ifdef's that got in because the
driver was originally based on code that worked on 2.4 as well as 2.6.
This patch removes the dead code.

Signed-off-by: Stephen Hemminger <a072e933f45880fe04500ea083d5c7f6e81a06f0@osdl.org>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/net/chelsio/cxgb2.c
+++ drivers/net/chelsio/cxgb2.c
@@ -56,46 +56,17 @@
 #include "sge.h"
 #include "espi.h"

-#ifdef work_struct
-#include <linux/tqueue.h>
-#define INIT_WORK INIT_TQUEUE
-#define schedule_work schedule_task
-#define flush_scheduled_work flush_scheduled_tasks
+#include <linux/workqueue.h>

 static inline void schedule_mac_stats_update(struct adapter *ap, int secs)
 {
-	mod_timer(&ap->stats_update_timer, jiffies + secs * HZ);
+	schedule_delayed_work(&ap->stats_update_task, secs * HZ);
 }

 static inline void cancel_mac_stats_update(struct adapter *ap)
 {
-	del_timer_sync(&ap->stats_update_timer);
-	flush_scheduled_tasks();
-}
-
-/*
- * Stats update timer for 2.4.  It schedules a task to do the actual update as
- * we need to access MAC statistics in process context.
- */
-static void mac_stats_timer(unsigned long data)
-{
-	struct adapter *ap = (struct adapter *)data;
-
-	schedule_task(&ap->stats_update_task);
-}
-#else
-#include <linux/workqueue.h>
-
-static inline void schedule_mac_stats_update(struct adapter *ap, int secs)
-{
-	schedule_delayed_work(&ap->stats_update_task, secs * HZ);
-}
-
-static inline void cancel_mac_stats_update(struct adapter *ap)
-{
 	cancel_delayed_work(&ap->stats_update_task);
 }
-#endif

 #define MAX_CMDQ_ENTRIES 16384
 #define MAX_CMDQ1_ENTRIES 1024
@@ -1090,12 +1061,6 @@
 				  ext_intr_task, adapter);
 			INIT_WORK(&adapter->stats_update_task, mac_stats_task,
 				  adapter);
-#ifdef work_struct
-			init_timer(&adapter->stats_update_timer);
-			adapter->stats_update_timer.function = mac_stats_timer;
-			adapter->stats_update_timer.data =
-				(unsigned long)adapter;
-#endif

 			pci_set_drvdata(pdev, netdev);
 		}


Commands for ssd1327 are updated according to datasheet


via-ircc: Remove useless return variables

This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.

Verified by compilation only.

The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
    when strict
return
- ret
+ C
;
// </smpl>

Signed-off-by: Peter Senna Tschudin <d897b756ebf1c425d034f7458a172204a9625378@gmail.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/irda/via-ircc.c
+++ drivers/net/irda/via-ircc.c
@@ -510,10 +510,8 @@
  */
 static int via_ircc_read_dongle_id(int iobase)
 {
-	int dongle_id = 9;	/* Default to IBM */
-
 	IRDA_ERROR("via-ircc: dongle probing not supported, please specify dongle_id module parameter.\n");
-	return dongle_id;
+	return 9;	/* Default to IBM */
 }

 /*
@@ -926,7 +924,6 @@
 static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
 {
 	int iobase;
-	int ret = TRUE;
 	u8 Tx_status;

 	IRDA_DEBUG(3, "%s()\n", __func__);
@@ -983,7 +980,7 @@
 	// Tell the network layer, that we can accept more frames
 	netif_wake_queue(self->netdev);
 //F01   }
-	return ret;
+	return TRUE;
 }

 /*


net/mlx5: mitigate Rx doorbell memory barrier

The RQ WQEs must be written in the memory before the HW gets the RQ
doorbell, hence a memory barrier should be triggered after the WQEs
writing and before the doorbell writing.

The current code used rte_wmb barrier which ensures that all the memory
stores were done while it is enough to use rte_cio_wmb barrier for the
local memory stores because the WQEs are in local memory.

CC: stable@dpdk.org

Signed-off-by: Matan Azrad <6969f5f553ad7652679a585a85d7321babc90464@mellanox.com>
Acked-by: Shahaf Shuler <59427d49da6f2b944fbf4cb5ee70ef3ac25f744f@mellanox.com>

--- drivers/net/mlx5/mlx5_rxq.c
+++ drivers/net/mlx5/mlx5_rxq.c
@@ -1076,7 +1076,7 @@
 	rxq_data->decompressed = 0;
 	/* Update doorbell counter. */
 	rxq_data->rq_ci = wqe_n >> rxq_data->sges_n;
-	rte_wmb();
+	rte_cio_wmb();
 	*rxq_data->rq_db = rte_cpu_to_be_32(rxq_data->rq_ci);
 	DRV_LOG(DEBUG, "port %u rxq %u updated with %p", dev->data->port_id,
 		idx, (void *)&tmpl);


qlge: Improve handling for firmware init failure.

This event will arrive at boot time or after an
MPI processor reset if the firmware failed to initialize.

Signed-off-by: Ron Mercer <4e7391ea092af2dfd5c2acda9e15f3b1d8ab5e88@qlogic.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/qlge/qlge_mpi.c
+++ drivers/net/qlge/qlge_mpi.c
@@ -395,7 +395,25 @@
 		ql_sfp_out(qdev, mbcp);
 		break;

+	/* This event can arrive at boot time or after an
+	 * MPI reset if the firmware failed to initialize.
+	 */
 	case AEN_FW_INIT_FAIL:
+		/* If we're in process on executing the firmware,
+		 * then convert the status to normal mailbox status.
+		 */
+		if (mbcp->mbox_in[0] == MB_CMD_EX_FW) {
+			mbcp->out_count = orig_count;
+			status = ql_get_mb_sts(qdev, mbcp);
+			mbcp->mbox_out[0] = MB_CMD_STS_ERR;
+			return status;
+		}
+		QPRINTK(qdev, DRV, ERR,
+			"Firmware initialization failed.\n");
+		status = -EIO;
+		ql_queue_fw_error(qdev);
+		break;
+
 	case AEN_SYS_ERR:
 		ql_queue_fw_error(qdev);
 		break;


airo: remove "basic_rate" module option

airo: remove "basic_rate" module option

The "basic_rate" module option is not implemented correctly.  If the
rate was set to zero it was supposed to set it to "basic_rate | 0x80".
Unfortunately the check to see if what zero was wrong and it checked
"!ai->config.rates" (which is always false) instead of
"!ai->config.rates[i]".

This option was just used for development and it wasn't documented
anywhere.  Instead of fixing it, we can just remove it.

Reported-by: Stanislaw Gruszka <1542dc81552e668e197a396f69e655c1621c300d@redhat.com>
Signed-off-by: Dan Carpenter <72501f147b2753e6660fdce744d9ac3084854f5e@gmail.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/airo.c
+++ drivers/net/wireless/airo.c
@@ -217,7 +217,6 @@
    (no spaces) list of rates (up to 8). */

 static int rates[8];
-static int basic_rate;
 static char *ssids[3];

 static int io[4];
@@ -250,7 +249,6 @@
 MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340/350");
 module_param_array(io, int, NULL, 0);
 module_param_array(irq, int, NULL, 0);
-module_param(basic_rate, int, 0);
 module_param_array(rates, int, NULL, 0);
 module_param_array(ssids, charp, NULL, 0);
 module_param(auto_wep, int, 0);
@@ -3884,15 +3882,6 @@
 				ai->config.rates[i] = rates[i];
 			}
 		}
-		if ( basic_rate > 0 ) {
-			for( i = 0; i < 8; i++ ) {
-				if ( ai->config.rates[i] == basic_rate ||
-				     !ai->config.rates ) {
-					ai->config.rates[i] = basic_rate | 0x80;
-					break;
-				}
-			}
-		}
 		set_bit (FLAG_COMMIT, &ai->flags);
 	}


[PATCH] airo: start with radio off

[PATCH] airo: start with radio off

Don't turn the radio on until the interface is up. This saves some power in
case the driver is loaded but the card is not used.

Signed-off-by: Michal Schmidt <b2f54855ee5c6e19cecf0e24bef2348da08eb16e@redhat.com>
Signed-off-by: John W. Linville <2a53bac7a5d324865ef46ec4c38b2c0fba1456b4@tuxdriver.com>

--- drivers/net/wireless/airo.c
+++ drivers/net/wireless/airo.c
@@ -2831,7 +2831,7 @@

 	ai = dev->priv;
 	ai->wifidev = NULL;
-	ai->flags = 0;
+	ai->flags = 1 << FLAG_RADIO_DOWN;
 	ai->jobs = 0;
 	ai->dev = dev;
 	if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) {


Initial revision

Initial revision

error: pathspec 'src/comp/comp.c' did not match any file(s) known to git

--- src/comp/comp.c
+++ src/comp/comp.c
@@ -0,0 +1,633 @@
+# include "comp.h"
+# include "interpret.h"
+# include "str.h"
+# include "array.h"
+# include "object.h"
+# include "data.h"
+# include "kfun.h"
+# include "node.h"
+# include "fcontrol.h"
+# include "compile.h"
+
+showclass(class)
+register short class;
+{
+    if (class & C_TYPECHECKED) printf("typechecked ");
+    if (class & C_UNDEFINED) printf("undefined ");
+    if (class & C_VARARGS) printf("varargs ");
+    if (class & C_PRIVATE) printf("private ");
+    if (class & C_STATIC) printf("static ");
+    if (class & C_LOCAL) printf("local ");
+    if (class & C_NOMASK) printf("nomask ");
+}
+
+void show_proto(func, proto)
+char *func, *proto;
+{
+    int i;
+
+    showclass(PROTO_CLASS(proto));
+    printf("%s %s(", c_typename(PROTO_FTYPE(proto)), func);
+    for (i = 0; i < PROTO_NARGS(proto) - 1; i++) {
+	printf("%s, ", c_typename(PROTO_ARGS(proto)[i]));
+    }
+    if (i < PROTO_NARGS(proto)) {
+	printf("%s", c_typename(PROTO_ARGS(proto)[i]));
+    }
+    putchar(')');
+}
+
+showctrl(ctrl)
+control *ctrl;
+{
+    register unsigned short i;
+
+    printf("virtual inherits:");
+    for (i = 0; i < UCHAR(ctrl->nvirtuals); i++) {
+	printf(" %s(%u %u)", o_name(ctrl->inherits[i].obj),
+	       ctrl->inherits[i].funcoffset,
+	       ctrl->inherits[i].varoffset);
+    }
+    putchar('\n');
+    if (i < UCHAR(ctrl->ninherits)) {
+	printf("labeled inherits:");
+	for ( ; i < UCHAR(ctrl->ninherits); i++) {
+	    printf(" %s(%u %u)", o_name(ctrl->inherits[i].obj),
+		   ctrl->inherits[i].funcoffset,
+		   ctrl->inherits[i].varoffset);
+	}
+	putchar('\n');
+    }
+    printf("progsize: %u\n", ctrl->progsize);
+    if (ctrl->nstrings > 0) {
+	printf("string constants:\n");
+	for (i = 0; i < ctrl->nstrings; i++) {
+	    printf(" %u: %s\n", i, ctrl->strings[i]->text);
+	}
+    }
+    if (ctrl->nfuncdefs > 0) {
+	printf("function definitions:\n");
+	for (i = 0; i < ctrl->nfuncdefs; i++) {
+	    printf(" %u: %04x ", i, ctrl->funcdefs[i].offset);
+	    show_proto(d_get_strconst(ctrl, ctrl->funcdefs[i].inherit,
+				      ctrl->funcdefs[i].index)->text,
+		       d_get_prog(ctrl) + ctrl->funcdefs[i].offset);
+	    putchar('\n');
+	}
+    }
+    if (ctrl->nvardefs > 0) {
+	printf("variable definitions:\n");
+	for (i = 0; i < ctrl->nvardefs; i++) {
+	    printf(" %u: ", i);
+	    showclass(ctrl->vardefs[i].class);
+	    printf("%s %s\n", c_typename(ctrl->vardefs[i].type),
+		   d_get_strconst(ctrl, ctrl->vardefs[i].inherit,
+				  ctrl->vardefs[i].index)->text);
+	}
+    }
+    if (ctrl->nfuncalls > 0) {
+	printf("funcalls:\n");
+	for (i = 0; i < ctrl->nfuncalls; i++) {
+	    control *c2;
+	    dfuncdef *f;
+
+	    c2 = ctrl->inherits[UCHAR(ctrl->funcalls[2 * i])].obj->ctrl;
+	    f = d_get_funcdefs(c2) + UCHAR(ctrl->funcalls[2 * i + 1]);
+	    printf(" %u: %s(%d, %d)\n", i,
+		   d_get_strconst(c2, f->inherit, f->index)->text,
+		   UCHAR(ctrl->funcalls[2 * i]),
+		   UCHAR(ctrl->funcalls[2 * i + 1]));
+	}
+    }
+    if (ctrl->nsymbols > 0) {
+	printf("symbols:\n");
+	for (i = 0; i < ctrl->nsymbols; i++) {
+	    control *c2;
+	    dfuncdef *f;
+	    char *name;
+
+	    c2 = ctrl->inherits[UCHAR(ctrl->symbols[i].inherit)].obj->ctrl;
+	    f = d_get_funcdefs(c2) + UCHAR(ctrl->symbols[i].index);
+	    name = d_get_strconst(c2, f->inherit, f->index)->text;
+	    printf(" %u: %s(%u)", i, name, ctrl->symbols[i].next);
+	    if (!(f->class & C_UNDEFINED) &&
+		ctrl_symb(ctrl, name) != &ctrl->symbols[i]) {
+		printf(" LOOKUP FAILED!");
+	    }
+	    putchar('\n');
+	}
+    }
+    printf("%u variables\n", ctrl->nvariables);
+}
+
+# define FETCH1S(pc)	SCHAR(*(pc)++)
+# define FETCH1U(pc)	UCHAR(*(pc)++)
+# define FETCH2S(pc, v)	((short) (v = *(pc)++ << 8, v |= UCHAR(*(pc)++)))
+# define FETCH2U(pc, v)	((unsigned short) (v = *(pc)++ << 8, \
+					   v |= UCHAR(*(pc)++)))
+# define FETCH4S(pc, v)	((Int) (v = *(pc)++ << 8, \
+				v |= UCHAR(*(pc)++), v <<= (Int) 8, \
+				v |= UCHAR(*(pc)++), v <<= (Int) 8, \
+				v |= UCHAR(*(pc)++)))
+
+unsigned short addr;
+unsigned short firstline;
+unsigned short line;
+unsigned short thisline;
+char *code;
+bool pop;
+int codesize;
+
+void show_instr(s)
+char *s;
+{
+    register int size;
+
+    printf("%04x\t", addr);
+    if (line != thisline) {
+	line = thisline;
+	printf("%4u\t", line);
+    } else {
+	putchar('\t');
+    }
+    size = codesize;
+    if (size > 4) {
+	size = 4;
+    }
+    switch (size) {
+    case 0:
+	printf("\t    ");
+	break;
+
+    case 1:
+	printf("%02x\t    ", UCHAR(code[0]));
+	break;
+
+    case 2:
+	printf("%02x %02x\t    ", UCHAR(code[0]), UCHAR(code[1]));
+	break;
+
+    case 3:
+	printf("%02x %02x %02x    ", UCHAR(code[0]), UCHAR(code[1]),
+	       UCHAR(code[2]));
+	break;
+
+    case 4:
+	printf("%02x %02x %02x %02x ", UCHAR(code[0]), UCHAR(code[1]),
+	       UCHAR(code[2]), UCHAR(code[3]));
+	break;
+    }
+    addr += size;
+    code += size;
+    codesize -= size;
+
+    if (pop) {
+	printf("P\t");
+    } else {
+	putchar('\t');
+    }
+    pop = FALSE;
+    if (s != (char *) NULL) {
+	printf("%s", s);
+    }
+    putchar('\n');
+    fflush(stdout);
+}
+
+void disasm(ctrl, func)
+control *ctrl;
+int func;
+{
+    char *pc, *end, buffer[100];
+    control *cc;
+    register unsigned short u, u2, u3;
+    register long l;
+    unsigned short a;
+
+    pc = end = d_get_prog(ctrl) + ctrl->funcdefs[func].offset;
+    show_proto(d_get_strconst(ctrl, ctrl->funcdefs[func].inherit,
+			      ctrl->funcdefs[func].index)->text, pc);
+    if (func == ctrl->nfuncdefs - 1) {
+	end += ctrl->progsize - ctrl->funcdefs[func].offset;
+    } else {
+	end += ctrl->funcdefs[func + 1].offset - ctrl->funcdefs[func].offset;
+    }
+    pc += PROTO_SIZE(pc);
+    printf("; %d local vars\n", FETCH1U(pc));
+    addr = 3;
+    line = 0;
+    firstline = thisline = FETCH2U(pc, u);
+    printf("addr\tline\tcode\t    pop instruction\n");
+    while (pc < end) {
+	code = pc;
+	pop = *code & I_POP_BIT;
+	thisline += ((*code & I_LINE_MASK) >> I_LINE_SHIFT) - 1;
+	switch (FETCH1U(pc) & I_INSTR_MASK) {
+	case I_PUSH_ZERO:
+	    codesize = 1;
+	    show_instr("PUSH_ZERO");
+	    break;
+
+	case I_PUSH_ONE:
+	    codesize = 1;
+	    show_instr("PUSH_ONE");
+	    break;
+
+	case I_PUSH_INT1:
+	    codesize = 2;
+	    sprintf(buffer, "PUSH_INT1 %d", FETCH1S(pc));
+	    show_instr(buffer);
+	    break;
+
+	case I_PUSH_INT2:
+	    codesize = 3;
+	    sprintf(buffer, "PUSH_INT2 %d", FETCH2S(pc, u));
+	    show_instr(buffer);
+	    break;
+
+	case I_PUSH_INT4:
+	    codesize = 5;
+	    sprintf(buffer, "PUSH_INT4 %ld", FETCH4S(pc, l));
+	    show_instr(buffer);
+	    break;
+
+	case I_PUSH_STRING:
+	    codesize = 2;
+	    u = FETCH1U(pc);
+	    sprintf(buffer, "PUSH_STRING %02x \"%s\"", u,
+		    d_get_strconst(ctrl, ctrl->nvirtuals - 1, u)->text);
+	    show_instr(buffer);
+	    break;
+
+	case I_PUSH_FAR_STRING:
+	    codesize = 4;
+	    u = FETCH1U(pc);
+	    FETCH2U(pc, u2);
+	    sprintf(buffer, "PUSH_FAR_STRING %02x %04x \"%s\"", u, u2,
+		    d_get_strconst(ctrl, u, u2)->text);
+	    show_instr(buffer);
+	    break;
+
+	case I_PUSH_LOCAL:
+	    codesize = 2;
+	    sprintf(buffer, "PUSH_LOCAL %d", FETCH1U(pc));
+	    show_instr(buffer);
+	    break;
+
+	case I_PUSH_GLOBAL:
+	    codesize = 3;
+	    u = FETCH1U(pc);
+	    u2 = FETCH1U(pc);
+	    cc = ctrl->inherits[u].obj->ctrl;
+	    sprintf(buffer, "PUSH_GLOBAL %02x %02x (%s)", u, u2,
+		    d_get_strconst(cc, cc->vardefs[u2].inherit,
+				   cc->vardefs[u2].index)->text);
+	    show_instr(buffer);
+	    break;
+
+	case I_PUSH_LOCAL_LVALUE:
+	    codesize = 2;
+	    sprintf(buffer, "PUSH_LOCAL_LVALUE %d", FETCH1U(pc));
+	    show_instr(buffer);
+	    break;
+
+	case I_PUSH_GLOBAL_LVALUE:
+	    codesize = 3;
+	    u = FETCH1U(pc);
+	    u2 = FETCH1U(pc);
+	    cc = ctrl->inherits[u].obj->ctrl;
+	    sprintf(buffer, "PUSH_GLOBAL_LVALUE %02x %02x (%s)", u, u2,
+		    d_get_strconst(cc, cc->vardefs[u2].inherit,
+				   cc->vardefs[u2].index)->text);
+	    show_instr(buffer);
+	    break;
+
+	case I_INDEX:
+	    codesize = 1;
+	    show_instr("INDEX");
+	    break;
+
+	case I_INDEX_LVALUE:
+	    codesize = 1;
+	    show_instr("INDEX_LVALUE");
+	    break;
+
+	case I_AGGREGATE:
+	    codesize = 3;
+	    sprintf(buffer, "AGGREGATE %u", FETCH2U(pc, u));
+	    show_instr(buffer);
+	    break;
+
+	case I_MAP_AGGREGATE:
+	    codesize = 3;
+	    sprintf(buffer, "MAP_AGGREGATE %u", FETCH2U(pc, u));
+	    show_instr(buffer);
+	    break;
+
+	case I_FETCH:
+	    codesize = 1;
+	    show_instr("FETCH");
+	    break;
+
+	case I_STORE:
+	    codesize = 1;
+	    show_instr("STORE");
+	    break;
+
+	case I_JUMP:
+	    codesize = 3;
+	    sprintf(buffer, "JUMP %04x", addr + FETCH2S(pc, u) + 1);
+	    show_instr(buffer);
+	    break;
+
+	case I_JUMP_ZERO:
+	    codesize = 3;
+	    sprintf(buffer, "JUMP_ZERO %04x", addr + FETCH2S(pc, u) + 1);
+	    show_instr(buffer);
+	    break;
+
+	case I_JUMP_NONZERO:
+	    codesize = 3;
+	    sprintf(buffer, "JUMP_NONZERO %04x", addr + FETCH2S(pc, u) + 1);
+	    show_instr(buffer);
+	    break;
+
+	case I_SWITCH_INT:
+	    codesize = 4;
+	    FETCH2U(pc, u);
+	    sprintf(buffer, "SWITCH_INT %u", u);
+	    show_instr(buffer);
+	    codesize = --u * 6 + 1;
+	    a = addr - 1;
+	    sprintf(buffer, " DEFAULT: %04x", a + FETCH2S(pc, u2));
+	    show_instr(buffer);
+	    a += 2;
+	    while (u > 0) {
+		long l;
+
+		FETCH4S(pc, l);
+		sprintf(buffer, " CASE %ld: %04x", l, a + FETCH2S(pc, u2) + 4);
+		show_instr(buffer);
+		a += 6;
+		--u;
+	    }
+	    break;
+
+	case I_SWITCH_RANGE:
+	    codesize = 4;
+	    FETCH2U(pc, u);
+	    sprintf(buffer, "SWITCH_RANGE %u", u);
+	    show_instr(buffer);
+	    codesize = --u * 10 + 1;
+	    a = addr - 1;
+	    sprintf(buffer, " DEFAULT: %04x", a + FETCH2S(pc, u2));
+	    show_instr(buffer);
+	    a += 2;
+	    while (u > 0) {
+		register long h;
+
+		FETCH4S(pc, l);
+		FETCH4S(pc, h);
+		sprintf(buffer, " CASE %ld .. %ld: %04x", l, h,
+			a + FETCH2U(pc, u2) + 8);
+		show_instr(buffer);
+		a += 10;
+		--u;
+	    }
+	    break;
+
+	case I_SWITCH_STR:
+	    codesize = 4;
+	    FETCH2U(pc, u);
+	    sprintf(buffer, "SWITCH_STR %u", u);
+	    show_instr(buffer);
+	    codesize = --u * 5 + 2;
+	    a = addr - 1;
+	    sprintf(buffer, " DEFAULT: %04x", a + FETCH2U(pc, u2));
+	    show_instr(buffer);
+	    a += 3;
+	    if (FETCH1U(pc) == 0) {
+		codesize -= 3;
+		sprintf(buffer, " CASE 0: %04x", a + FETCH2S(pc, u2));
+		show_instr(buffer);
+		a += 2;
+		--u;
+	    }
+	    while (u > 0) {
+		string *str;
+		int i;
+
+		i = FETCH1U(pc);
+		str = d_get_strconst(ctrl, i, FETCH2S(pc, u2));
+		sprintf(buffer, " CASE \"%s\": %04x", str->text,
+			a + FETCH2U(pc, u2) + 3);
+		show_instr(buffer);
+		a += 5;
+		--u;
+	    }
+	    break;
+
+	case I_CALL_KFUNC:
+	    u = FETCH1U(pc);
+	    if (PROTO_CLASS(kftab[u].proto) & C_VARARGS) {
+		codesize = 3;
+		sprintf(buffer, "CALL_KFUNC %02x (%s) %d", u, kftab[u].name,
+			FETCH1U(pc));
+	    } else {
+		codesize = 2;
+		sprintf(buffer, "CALL_KFUNC %02x (%s) %d", u, kftab[u].name,
+			PROTO_NARGS(kftab[u].proto));
+	    }
+	    show_instr(buffer);
+	    break;
+
+	case I_CALL_LFUNC:
+	    codesize = 5;
+	    u = FETCH1U(pc);
+	    u2 = FETCH1U(pc);
+	    u3 = FETCH1U(pc);
+	    cc = ctrl->inherits[u].obj->ctrl->inherits[u2].obj->ctrl;
+	    sprintf(buffer, "CALL_LFUNC %02x %02x %02x (%s) %d", u, u2, u3,
+		    d_get_strconst(cc, cc->funcdefs[u3].inherit,
+				   cc->funcdefs[u3].index)->text,
+		    FETCH1U(pc));
+	    show_instr(buffer);
+	    break;
+
+	case I_CALL_DFUNC:
+	    codesize = 4;
+	    u = FETCH1U(pc);
+	    u2 = FETCH1U(pc);
+	    cc = ctrl->inherits[u].obj->ctrl;
+	    sprintf(buffer, "CALL_DFUNC %02x %02x (%s) %d", u, u2,
+		    d_get_strconst(cc, cc->funcdefs[u2].inherit,
+				   cc->funcdefs[u2].index)->text,
+		    FETCH1U(pc));
+	    show_instr(buffer);
+	    break;
+
+	case I_CALL_FUNC:
+	    codesize = 4;
+	    FETCH2U(pc, u);
+	    u2 = ctrl->funcalls[2 * u];
+	    u3 = ctrl->funcalls[2 * u + 1];
+	    cc = ctrl->inherits[u2].obj->ctrl;
+	    sprintf(buffer, "CALL_FUNC %04x (%s) %d", u,
+		    d_get_strconst(cc, cc->funcdefs[u3].inherit,
+				   cc->funcdefs[u3].index)->text,
+		    FETCH1U(pc));
+	    show_instr(buffer);
+	    break;
+
+	case I_CATCH:
+	    codesize = 3;
+	    sprintf(buffer, "CATCH %04x", addr + FETCH2S(pc, u) + 1);
+	    show_instr(buffer);
+	    break;
+
+	case I_LOCK:
+	    codesize = 1;
+	    show_instr("LOCK");
+	    break;
+
+	case I_RETURN:
+	    codesize = 1;
+	    show_instr("RETURN");
+	    break;
+
+	case I_LINE:
+	    codesize = 2;
+	    u = FETCH1U(pc);
+	    thisline = firstline + u;
+	    sprintf(buffer, "LINE %u", thisline);
+	    show_instr(buffer);
+	    break;
+
+	case I_LINE2:
+	    codesize = 3;
+	    FETCH2U(pc, thisline);
+	    sprintf(buffer, "LINE %u", thisline);
+	    show_instr(buffer);
+	    break;
+
+	default:
+	    addr += 1;
+	    codesize = 0;
+	    printf("unknown instruction %d\n", *code & I_INSTR_MASK);
+	    break;
+	}
+	while (codesize > 0) {
+	    show_instr((char *) NULL, 0);
+	}
+    }
+}
+
+main(argc, argv)
+int argc;
+char *argv[];
+{
+    typedef struct _list_ {
+	control *ctrl;
+	struct _list_ *next;
+    } list;
+    list *l, *c;
+    int n, i, j;
+    static char *paths[] = { "/usr/include", 0 };
+
+    str_init();
+    arr_init();
+    o_init(100);
+    kf_init();
+    c_init("auto", "driver", "std.h", paths, FALSE);
+
+    n = 0;
+    l = (list *) NULL;
+    for (;;) {
+	char buffer[100];
+
+	printf("\n[%d compiled] ", n);
+	gets(buffer);
+	switch (buffer[0]) {
+	case 'c':
+	    if (ec_push()) {
+		warning((char *) NULL);
+		return 1;
+	    }
+	    c = ALLOC(list, 1);
+	    c->ctrl = c_compile(buffer + 2)->ctrl;
+	    ec_pop();
+	    c->next = l;
+	    l = c;
+	    n++;
+	    break;
+
+	case 'v':
+	    i = atoi(buffer + 1);
+	    if (i <= 0 || i > n) {
+		putchar('\007');
+		break;
+	    }
+	    c = l;
+	    for (i = n - i; i > 0; --i) {
+		c = c->next;
+	    }
+	    if (c->ctrl == (control *) NULL) {
+		printf("<destructed>\n");
+	    } else {
+		showctrl(c->ctrl);
+	    }
+	    break;
+
+	case 'p':
+	    sscanf(buffer + 1, "%d,%d", &i, &j);
+	    if (i <= 0 || i > n) {
+		putchar('\007');
+		break;
+	    }
+	    c = l;
+	    for (i = n - i; i > 0; --i) {
+		c = c->next;
+	    }
+	    if (c->ctrl == (control *) NULL) {
+		printf("<destructed>\n");
+	    } else {
+		if (j <= 0 || j > c->ctrl->nfuncdefs) {
+		    putchar('\007');
+		    break;
+		}
+		disasm(c->ctrl, j - 1);
+	    }
+	    break;
+
+	case 'd':
+	    i = atoi(buffer + 1);
+	    if (i <= 0 || i > n) {
+		putchar('\007');
+		break;
+	    }
+	    c = l;
+	    for (i = n - i; i > 0; --i) {
+		c = c->next;
+	    }
+	    o_del(c->ctrl->inherits[c->ctrl->nvirtuals - 1].obj);
+	    o_clean();
+	    c->ctrl = (control *) NULL;
+	    break;
+
+	case 'q':
+	    return 0;
+
+	default:
+	    putchar('\007');
+	    break;
+	}
+    }
+}
+
+bool i_apply() {}
+void i_del_value() {}
+void i_pop() {}
+value *sp;
+object *i_this_object() {}
+object *i_prev_object() {}
+void i_push_value() {}


Export exception classes with default visibility

Summary:
This fixes a crash caused by a `JSError` exception not being successfully caught in a different dynamic library from where it was thrown. Since the libraries were compiled with hidden symbols and loaded with `RTLD_LOCAL`, the exception typeinfo becomes unique to each module.

Reading on this subject:
https://gcc.gnu.org/wiki/Visibility
https://stackoverflow.com/questions/14268736/symbol-visibility-exceptions-runtime-error

Reviewed By: mhorowitz

Differential Revision: D19343161

fbshipit-source-id: 4eb3bc2576bbcca2c3aef4f52b5a27dfde214c6a

--- ReactCommon/jsi/jsi/jsi.h
+++ ReactCommon/jsi/jsi/jsi.h
@@ -1191,7 +1191,7 @@
 };

 /// Base class for jsi exceptions
-class JSIException : public std::exception {
+class JSI_EXPORT JSIException : public std::exception {
  protected:
   JSIException(){};
   JSIException(std::string what) : what_(std::move(what)){};
@@ -1207,7 +1207,7 @@

 /// This exception will be thrown by API functions on errors not related to
 /// JavaScript execution.
-class JSINativeException : public JSIException {
+class JSI_EXPORT JSINativeException : public JSIException {
  public:
   JSINativeException(std::string what) : JSIException(std::move(what)) {}
 };
@@ -1215,7 +1215,7 @@
 /// This exception will be thrown by API functions whenever a JS
 /// operation causes an exception as described by the spec, or as
 /// otherwise described.
-class JSError : public JSIException {
+class JSI_EXPORT JSError : public JSIException {
  public:
   /// Creates a JSError referring to provided \c value
   JSError(Runtime& r, Value&& value);


regulator: Mark attributes table for virtual regulator static

It's not exported.

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <a57ef363056e61beffa2efa59c68550d40db03b0@slimlogic.co.uk>

--- drivers/regulator/virtual.c
+++ drivers/regulator/virtual.c
@@ -260,7 +260,7 @@
 static DEVICE_ATTR(max_microamps, 0666, show_max_uA, set_max_uA);
 static DEVICE_ATTR(mode, 0666, show_mode, set_mode);

-struct device_attribute *attributes[] = {
+static struct device_attribute *attributes[] = {
 	&dev_attr_min_microvolts,
 	&dev_attr_max_microvolts,
 	&dev_attr_min_microamps,


tty: add missing tty_port_tty_get() call to raw3215_wakeup

Fix compile error caused by "TTY: con3215, use tty from tty_port":

 CC      drivers/s390/char/con3215.o
drivers/s390/char/con3215.c: In function 'raw3215_wakeup':
drivers/s390/char/con3215.c:339:16: error: 'struct raw3215_info' has no member named 'tty'
make[1]: *** [drivers/s390/char/con3215.o] Error 1
make: *** [drivers/s390/char/] Error 2

Cc: Martin Schwidefsky <52616596d8f5df0d597e85ab515377f92f939c68@de.ibm.com>
Signed-off-by: Heiko Carstens <8dcf0f69152f32f23184f83357a3731522e56b9c@de.ibm.com>
Acked-by: Jiri Slaby <dfbf39eb5bf303a3db5454d815cb8c8888cbadf9@suse.cz>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/s390/char/con3215.c
+++ drivers/s390/char/con3215.c
@@ -336,7 +336,11 @@
 static void raw3215_wakeup(unsigned long data)
 {
 	struct raw3215_info *raw = (struct raw3215_info *) data;
-	tty_wakeup(raw->tty);
+	struct tty_struct *tty;
+
+	tty = tty_port_tty_get(&raw->port);
+	tty_wakeup(tty);
+	tty_kref_put(tty);
 }

 /*


[S390] 3270 console build fix

[S390] 3270 console build fix

Fix this build failure:
drivers/s390/built-in.o: In function `raw3270_pm_unfreeze':
(.text+0x3ac04): undefined reference to `ccw_device_force_console'
with:
CONFIG_TN3270=y
CONFIG_TN3270_CONSOLE=n
CONFIG_TN3215_CONSOLE=n

Reported-by: Kamalesh Babulal <30b3129b1a1b0120e30fdc2f7d8e6560be5d0735@linux.vnet.ibm.com>
Signed-off-by: Sebastian Ott <34be3ca399e9e73d80098c083a5b58614c3ca6da@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <52616596d8f5df0d597e85ab515377f92f939c68@de.ibm.com>

--- drivers/s390/char/raw3270.c
+++ drivers/s390/char/raw3270.c
@@ -1361,11 +1361,13 @@

 void raw3270_pm_unfreeze(struct raw3270_view *view)
 {
+#ifdef CONFIG_TN3270_CONSOLE
 	struct raw3270 *rp;

 	rp = view->dev;
 	if (rp && test_bit(RAW3270_FLAGS_FROZEN, &rp->flags))
 		ccw_device_force_console();
+#endif
 }

 static struct ccw_device_id raw3270_id[] = {


allow threads to run when in getinfo

allow threads to run when in getinfo

--- pycurl/curl.c
+++ pycurl/curl.c
@@ -322,7 +322,9 @@
 	    option == CURLINFO_HTTP_CODE)
 	    {
 		/* Return long as result */
+		Py_BEGIN_ALLOW_THREADS
 		res = curl_easy_getinfo(self->handle, option, &l_res);
+		Py_END_ALLOW_THREADS
 		/* Check for errors and return result */
 		if (res == 0) {
 		    return PyLong_FromLong(l_res);
@@ -335,7 +337,9 @@
 	if (option == CURLINFO_EFFECTIVE_URL)
 	    {
 		/* Return string as result */
+		Py_BEGIN_ALLOW_THREADS
 		res = curl_easy_getinfo(self->handle, option, &s_res);
+		Py_END_ALLOW_THREADS
 		/* Check for errors and return result */
 		if (res == 0) {
 		    return PyString_FromString(s_res);
@@ -357,7 +361,9 @@
 	    option == CURLINFO_CONTENT_LENGTH_UPLOAD)
 	    {
 		/* Return float as result */
+		Py_BEGIN_ALLOW_THREADS
 		res = curl_easy_getinfo(self->handle, option, &d_res);
+		Py_END_ALLOW_THREADS
 		if (res == 0) {
 		    return PyFloat_FromDouble(d_res);
 		} else {


spi/omap-100k: Remove empty reset function

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>


drivers: spi: nrfx: Update get_nrf_spim_frequency for nRF5340 HS-SPI

Using SPIM_FREQUENCY_FREQUENCY_M32 to check if the device has HS-SPI and
able to use higher SPI clock than 8MHz.

Signed-off-by: Jui-Chou Chung <9535e41c4cc541f415d41b03ffef0b5b48a68fad@nordicsemi.no>

--- drivers/spi/spi_nrfx_spim.c
+++ drivers/spi/spi_nrfx_spim.c
@@ -59,7 +59,10 @@
 		return NRF_SPIM_FREQ_2M;
 	} else if (frequency < 8000000) {
 		return NRF_SPIM_FREQ_4M;
-#if defined(CONFIG_SOC_NRF52833) || defined(CONFIG_SOC_NRF52840)
+/* Only the devices with HS-SPI can use SPI clock higher than 8 MHz and
+ * have SPIM_FREQUENCY_FREQUENCY_M32 defined in their own bitfields.h
+ */
+#if defined(SPIM_FREQUENCY_FREQUENCY_M32)
 	} else if (frequency < 16000000) {
 		return NRF_SPIM_FREQ_8M;
 	} else if (frequency < 32000000) {


Staging: i2o: Remove space after the * in a pointer type variable

This patch is to remove space after the * in pointer type function parameters
in function prototype and definition to follow kernel coding conventions.

Signed-off-by: Vatika Harlalka <d013f721411c2b850e8e38d19dd6980e084cb0ef@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/i2o/debug.c
+++ drivers/staging/i2o/debug.c
@@ -5,7 +5,7 @@

 static void i2o_report_util_cmd(u8 cmd);
 static void i2o_report_exec_cmd(u8 cmd);
-static void i2o_report_fail_status(u8 req_status, u32 * msg);
+static void i2o_report_fail_status(u8 req_status, u32 *msg);
 static void i2o_report_common_status(u8 req_status);
 static void i2o_report_common_dsc(u16 detailed_status);

@@ -66,7 +66,7 @@
  * Following fail status are common to all classes.
  * The preserved message must be handled in the reply handler.
  */
-static void i2o_report_fail_status(u8 req_status, u32 * msg)
+static void i2o_report_fail_status(u8 req_status, u32 *msg)
 {
 	static char *FAIL_STATUS[] = {
 		"0x80",		/* not used */


cdc-acm: fix power management in ioctl

cdc-acm: fix power management in ioctl

An ioctl that does depends on communication with a device should
prevent suspension of teh device.

Signed-off-by: Oliver Neukum <bfee72d94d376f4e00f72b756466867d7f9eb24e@suse.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


usb: dwc3: initialize platform data at pci glue layer

This patch initializes platform data at pci glue layer, and SoCs x86-based
platform vendor is able to define their flags in platform data at bus glue
layer. Then do some independent behaviors at dwc3 core level.

Signed-off-by: Huang Rui <3d137cbcc79a0a89c72e4e9b642446ed2999ace4@amd.com>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>


usb: host: ehci-msm: fix PHY error handling

PHY layer no longer returns NULL. We must
switch from IS_ERR_OR_NULL() to IS_ERR().

Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

--- drivers/usb/host/ehci-msm.c
+++ drivers/usb/host/ehci-msm.c
@@ -145,7 +145,7 @@
 	 * management.
 	 */
 	phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
-	if (IS_ERR_OR_NULL(phy)) {
+	if (IS_ERR(phy)) {
 		dev_err(&pdev->dev, "unable to find transceiver\n");
 		ret = -ENODEV;
 		goto put_hcd;


usb: ehci-s5p: fix: Fix null pointer dereferencing

7edb3da: (USB: EHCI: make ehci-s5p a separate driver)
raised an issue with ehci-s5p's driver data.
Now that 's5p_ehci_hcd' doesn't maintain pointer to 'usb_hcd'
and s5p_ehci is nothing but a pointer to hcd->priv;
add hcd to the driver data rather than s5p_ehci.

This fixes issues with null pointer dereferencing in
s5p_ehci_shutdown(), s5p_ehci_suspend(), s5p_ehci_resume().

Signed-off-by: Vivek Gautam <5c6bd423a2e3d98ebdccbc25654ed1942ee0af9f@samsung.com>
CC: Manjunath Goudar <aac89f92ddf6bd34bbb6806f6987d72a29f96539@linaro.org>
CC: Arnd Bergmann <f2c659f01951776204a6c5b902787d9019fbeebd@arndb.de>
CC: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Acked-by: Arnd Bergmann <f2c659f01951776204a6c5b902787d9019fbeebd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/usb/host/ehci-s5p.c
+++ drivers/usb/host/ehci-s5p.c
@@ -173,7 +173,7 @@
 		goto fail_add_hcd;
 	}

-	platform_set_drvdata(pdev, s5p_ehci);
+	platform_set_drvdata(pdev, hcd);

 	return 0;


fhci-hub: use USB_DT_HUB

fhci-hub: use USB_DT_HUB

Fix  using the  bare number to set the 'bDescriptorType' field of the Hub
Descriptor while the value  is #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <d8c69075be49b0738b690ec4af0e9025b8c97c9e@cogentembedded.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


ohci-hub: use USB_DT_HUB

ohci-hub: use USB_DT_HUB

Fix  using the  bare number to set the 'bDescriptorType' field of the Hub
Descriptor while the value  is #define'd in <linux/usb/ch11.h>.

Signed-off-by: Sergei Shtylyov <d8c69075be49b0738b690ec4af0e9025b8c97c9e@cogentembedded.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


USB: OHCI: add missing PCI PM callbacks to ohci-pci.c

Commit c1117afb8589 (USB: OHCI: make ohci-pci a separate driver)
neglected to preserve the entries for the pci_suspend and pci_resume
driver callbacks.  As a result, OHCI controllers don't work properly
during suspend and after hibernation.

This patch adds the missing callbacks to the driver.

Signed-off-by: Alan Stern <75ea6bb7bfc1186f92d26164de5f9268c9a45b59@rowland.harvard.edu>
Reported-and-tested-by: Steve Cotton <9ce5770b3bb4b2a1d59be2d97e34379cd192299f@s.cotton.clara.co.uk>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


USB: UHCI: improve comments and logic for root-hub suspend

This patch (as1488) improves the comments and logic in uhci-hcd's
suspend routine.  The existing comments are hard to understand and
don't give a good idea of what's really going on.

The question of whether EGSM (Enter Global Suspend Mode) and RD
(enable Resume Detect interrupts) can be useful when they're not both
set is difficult.  The spec doesn't give any details on how they
interact with system wakeup, although clearly they are meant to be
used together.  To be safe, the patch changes the subroutine so that
neither bit gets set unless they both do.  There shouldn't be any
functional changes from this; only systems that are designed badly or
broken in some way need to avoid using those bits.

Signed-off-by: Alan Stern <75ea6bb7bfc1186f92d26164de5f9268c9a45b59@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/host/uhci-hcd.c
+++ drivers/usb/host/uhci-hcd.c
@@ -294,50 +294,50 @@
 	 * and that remote wakeups should be enabled.
 	 */
 	egsm_enable = USBCMD_EGSM;
-	uhci->RD_enable = 1;
 	int_enable = USBINTR_RESUME;
 	wakeup_enable = 1;

-	/* In auto-stop mode wakeups must always be detected, but
-	 * Resume-Detect interrupts may be prohibited.  (In the absence
-	 * of CONFIG_PM, they are always disallowed.)
+	/*
+	 * In auto-stop mode, we must be able to detect new connections.
+	 * The user can force us to poll by disabling remote wakeup;
+	 * otherwise we will use the EGSM/RD mechanism.
 	 */
 	if (auto_stop) {
 		if (!device_may_wakeup(&rhdev->dev))
-			int_enable = 0;
-
-	/* In bus-suspend mode wakeups may be disabled, but if they are
-	 * allowed then so are Resume-Detect interrupts.
-	 */
-	} else {
+			egsm_enable = int_enable = 0;
+	}
+
 #ifdef CONFIG_PM
+	/*
+	 * In bus-suspend mode, we use the wakeup setting specified
+	 * for the root hub.
+	 */
+	else {
 		if (!rhdev->do_remote_wakeup)
 			wakeup_enable = 0;
-#endif
-	}
-
-	/* EGSM causes the root hub to echo a 'K' signal (resume) out any
-	 * port which requests a remote wakeup.  According to the USB spec,
-	 * every hub is supposed to do this.  But if we are ignoring
-	 * remote-wakeup requests anyway then there's no point to it.
-	 * We also shouldn't enable EGSM if it's broken.
-	 */
-	if (!wakeup_enable || global_suspend_mode_is_broken(uhci))
-		egsm_enable = 0;
-
-	/* If we're ignoring wakeup events then there's no reason to
-	 * enable Resume-Detect interrupts.  We also shouldn't enable
-	 * them if they are broken or disallowed.
+	}
+#endif
+
+	/*
+	 * UHCI doesn't distinguish between wakeup requests from downstream
+	 * devices and local connect/disconnect events.  There's no way to
+	 * enable one without the other; both are controlled by EGSM.  Thus
+	 * if wakeups are disallowed then EGSM must be turned off -- in which
+	 * case remote wakeup requests from downstream during system sleep
+	 * will be lost.
 	 *
-	 * This logic may lead us to enabling RD but not EGSM.  The UHCI
-	 * spec foolishly says that RD works only when EGSM is on, but
-	 * there's no harm in enabling it anyway -- perhaps some chips
-	 * will implement it!
-	 */
-	if (!wakeup_enable || resume_detect_interrupts_are_broken(uhci) ||
-			!int_enable)
-		uhci->RD_enable = int_enable = 0;
-
+	 * In addition, if EGSM is broken then we can't use it.  Likewise,
+	 * if Resume-Detect interrupts are broken then we can't use them.
+	 *
+	 * Finally, neither EGSM nor RD is useful by itself.  Without EGSM,
+	 * the RD status bit will never get set.  Without RD, the controller
+	 * won't generate interrupts to tell the system about wakeup events.
+	 */
+	if (!wakeup_enable || global_suspend_mode_is_broken(uhci) ||
+			resume_detect_interrupts_are_broken(uhci))
+		egsm_enable = int_enable = 0;
+
+	uhci->RD_enable = !!int_enable;
 	uhci_writew(uhci, int_enable, USBINTR);
 	uhci_writew(uhci, egsm_enable | USBCMD_CF, USBCMD);
 	mb();
@@ -364,10 +364,12 @@
 	uhci->rh_state = new_state;
 	uhci->is_stopped = UHCI_IS_STOPPED;

-	/* If interrupts don't work and remote wakeup is enabled then
-	 * the suspended root hub needs to be polled.
-	 */
-	if (!int_enable && wakeup_enable)
+	/*
+	 * If remote wakeup is enabled but either EGSM or RD interrupts
+	 * doesn't work, then we won't get an interrupt when a wakeup event
+	 * occurs.  Thus the suspended root hub needs to be polled.
+	 */
+	if (wakeup_enable && (!int_enable || !egsm_enable))
 		set_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(uhci)->flags);
 	else
 		clear_bit(HCD_FLAG_POLL_RH, &uhci_to_hcd(uhci)->flags);


[PATCH] pl2303 - status line

[PATCH] pl2303 - status line

I'm attaching a patch to fix status when using Siemens X65
mobile. This mobile use first byte instead of normal UART_STATE
byte.

From: Flavio Leitner <fbl@conectiva.com.br>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Index: gregkh-2.6/drivers/usb/serial/pl2303.c
===================================================================

--- drivers/usb/serial/pl2303.c
+++ drivers/usb/serial/pl2303.c
@@ -817,15 +817,40 @@
 	}
 }

+static void pl2303_update_line_status(struct usb_serial_port *port,
+				      unsigned char *data,
+				      unsigned int actual_length)
+{
+
+	struct pl2303_private *priv = usb_get_serial_port_data(port);
+	unsigned long flags;
+	u8 status_idx = UART_STATE;
+	u8 length = UART_STATE;
+
+	if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) &&
+	    (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65)) {
+		length = 1;
+		status_idx = 0;
+	}
+
+	if (actual_length < length)
+		goto exit;
+
+        /* Save off the uart status for others to look at */
+	spin_lock_irqsave(&priv->lock, flags);
+	priv->line_status = data[status_idx];
+	spin_unlock_irqrestore(&priv->lock, flags);
+
+exit:
+	return;
+}

 static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
-	struct pl2303_private *priv = usb_get_serial_port_data(port);
 	unsigned char *data = urb->transfer_buffer;
-	unsigned long flags;
+	unsigned int actual_length = urb->actual_length;
 	int status;
-	u8 uart_state;

 	dbg("%s (%d)", __FUNCTION__, port->number);

@@ -844,19 +869,9 @@
 		goto exit;
 	}

-
 	usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
-
-	if (urb->actual_length < UART_STATE)
-		goto exit;
-
-	/* Save off the uart status for others to look at */
-	uart_state = data[UART_STATE];
-	spin_lock_irqsave(&priv->lock, flags);
-	uart_state |= (priv->line_status & UART_STATE_TRANSIENT_MASK);
-	priv->line_status = uart_state;
-	spin_unlock_irqrestore(&priv->lock, flags);
-
+	pl2303_update_line_status(port, data, actual_length);
+
 exit:
 	status = usb_submit_urb (urb, GFP_ATOMIC);
 	if (status)


atmel_lcdfb: fix oops in rmmod when framebuffer fails to register

If framebuffer registration failed in platform driver ->probe() callback,
dev_get_drvdata() points to freed memory region, but ->remove() function
try to use it and the following oops occurs:

Unable to handle kernel NULL pointer dereference at virtual address 00000228
pgd = c3a20000
[00000228] *pgd=23a2b031, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1]
Modules linked in: atmel_lcdfb(-) cfbcopyarea cfbimgblt cfbfillrect [last unloaded: atmel_lcdfb]
CPU: 0    Not tainted  (2.6.27-rc2 #116)
PC is at atmel_lcdfb_remove+0x14/0xf8 [atmel_lcdfb]
LR is at platform_drv_remove+0x20/0x24
pc : [<bf006bc4>]    lr : [<c0157d28>]    psr: a0000013
sp : c3a45e84  ip : c3a45ea0  fp : c3a45e9c
r10: 00000002  r9 : c3a44000  r8 : c0026c04
r7 : 00000880  r6 : c02bb228  r5 : 00000000  r4 : c02bb230
r3 : bf007e3c  r2 : c02bb230  r1 : 00000004  r0 : c02bb228
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 0005317f  Table: 23a20000  DAC: 00000015
Process rmmod (pid: 6799, stack limit = 0xc3a44260)
Stack: (0xc3a45e84 to 0xc3a46000)
5e80:          c02bb230 bf007e3c bf007e3c c3a45eac c3a45ea0 c0157d28 bf006bc0
5ea0: c3a45ec4 c3a45eb0 c0156d20 c0157d18 c02bb230 c02bb2d8 c3a45ee0 c3a45ec8
5ec0: c0156da8 c0156cb8 bf007e3c bf007ee0 c02c8e14 c3a45efc c3a45ee4 c0156018
5ee0: c0156d50 bf007e3c bf007ee0 00000000 c3a45f18 c3a45f00 c0157220 c0155f9c
5f00: 00000000 bf007ee0 bf008000 c3a45f28 c3a45f1c c0157e34 c01571ec c3a45f38
5f20: c3a45f2c bf006ba8 c0157e30 c3a45fa4 c3a45f3c c005772c bf006ba4 656d7461
5f40: 636c5f6c 00626664 c004c988 c3a45f80 c3a45f5c 00000000 c3a45fb0 00000000
5f60: ffffffff becaccd8 00000880 00000000 000a5e80 00000001 bf007ee0 00000880
5f80: c3a45f84 00000000 becaccd4 00000002 000003df 00000081 00000000 c3a45fa8
5fa0: c0026a60 c0057584 00000002 000003df 00900081 000a5e80 00000880 00000000
5fc0: becaccd4 00000002 000003df 00000000 000a5e80 00000001 00000002 0000005f
5fe0: 4004f5ec becacbe8 0001a158 4004f5fc 20000010 00900081 f9ffbadf 7bbfb2bb
Backtrace:
[<bf006bb0>] (atmel_lcdfb_remove+0x0/0xf8 [atmel_lcdfb]) from [<c0157d28>] (platform_drv_remove+0x20/0x24)
 r6:bf007e3c r5:bf007e3c r4:c02bb230
[<c0157d08>] (platform_drv_remove+0x0/0x24) from [<c0156d20>] (__device_release_driver+0x78/0x98)
[<c0156ca8>] (__device_release_driver+0x0/0x98) from [<c0156da8>] (driver_detach+0x68/0x90)
 r5:c02bb2d8 r4:c02bb230
[<c0156d40>] (driver_detach+0x0/0x90) from [<c0156018>] (bus_remove_driver+0x8c/0xb4)
 r6:c02c8e14 r5:bf007ee0 r4:bf007e3c
[<c0155f8c>] (bus_remove_driver+0x0/0xb4) from [<c0157220>] (driver_unregister+0x44/0x48)
 r6:00000000 r5:bf007ee0 r4:bf007e3c
[<c01571dc>] (driver_unregister+0x0/0x48) from [<c0157e34>] (platform_driver_unregister+0x14/0x18)
 r6:bf008000 r5:bf007ee0 r4:00000000
[<c0157e20>] (platform_driver_unregister+0x0/0x18) from [<bf006ba8>] (atmel_lcdfb_exit+0x14/0x1c [atmel_lcdfb])
[<bf006b94>] (atmel_lcdfb_exit+0x0/0x1c [atmel_lcdfb]) from [<c005772c>] (sys_delete_module+0x1b8/0x22c)
[<c0057574>] (sys_delete_module+0x0/0x22c) from [<c0026a60>] (ret_fast_syscall+0x0/0x2c)
 r7:00000081 r6:000003df r5:00000002 r4:becaccd4
Code: e92dd870 e24cb004 e59050c4 e1a06000 (e5954228)
---[ end trace 85476b184d9e68d8 ]---

This patch fixes the oops.

Signed-off-by: Stanislaw Gruszka <2ec9e03c860a4b259d1dd6980a011b203dc174e0@wp.pl>
Acked-by: Nicolas Ferre <45b517be0e5ec6dc3a39715767c1d18e090d39b4@atmel.com>
Acked-by: Krzysztof Helt <e36322531041744f35a39a40f0faffcfb5b388ff@wp.pl>
Cc: Haavard Skinnemoen <de7418319212d7eab32260a76732c1f83e514852@atmel.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/video/atmel_lcdfb.c
+++ drivers/video/atmel_lcdfb.c
@@ -939,7 +939,7 @@
 	ret = register_framebuffer(info);
 	if (ret < 0) {
 		dev_err(dev, "failed to register framebuffer device: %d\n", ret);
-		goto free_cmap;
+		goto reset_drvdata;
 	}

 	/* add selected videomode to modelist */
@@ -955,7 +955,8 @@

 	return 0;

-
+reset_drvdata:
+	dev_set_drvdata(dev, NULL);
 free_cmap:
 	fb_dealloc_cmap(&info->cmap);
 unregister_irqs:
@@ -992,10 +993,11 @@
 {
 	struct device *dev = &pdev->dev;
 	struct fb_info *info = dev_get_drvdata(dev);
-	struct atmel_lcdfb_info *sinfo = info->par;
-
-	if (!sinfo)
+	struct atmel_lcdfb_info *sinfo;
+
+	if (!info || !info->par)
 		return 0;
+	sinfo = info->par;

 	cancel_work_sync(&sinfo->task);
 	exit_backlight(sinfo);


[PATCH] drivers/video/sis/init301.h: removal of old code

Signed-off-by: Michal Piotrowski <38df9e549cb6037ae2f776cd03ea30db340f266b@gmail.com>
Cc: "Antonino A. Daplas" <be03a811842969f6b435f66cb85a30eb479a8702@pol.net>
Cc: Thomas Winischhofer <5f50a84c1fa3bcff146405017f36aec1a10a9e38@winischhofer.net>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/video/sis/init301.h
+++ drivers/video/sis/init301.h
@@ -71,15 +71,8 @@
 #include <linux/types.h>
 #include <asm/io.h>
 #include <linux/fb.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include <video/fbcon.h>
-#endif
 #include "sis.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include <linux/sisfb.h>
-#else
 #include <video/sisfb.h>
-#endif
 #endif

 static const unsigned char SiS_YPbPrTable[3][64] = {


w1: mxc_w1: Convert to platform driver

w1: mxc_w1: Convert to platform driver

Using module_platform_driver() makes the code smaller and cleaner.

Signed-off-by: Fabio Estevam <679188261afeb60eb822cd934fd7b46a48ddd743@freescale.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/w1/masters/mxc_w1.c
+++ drivers/w1/masters/mxc_w1.c
@@ -191,21 +191,9 @@
 		   .name = "mxc_w1",
 	},
 	.probe = mxc_w1_probe,
-	.remove = mxc_w1_remove,
+	.remove = __devexit_p(mxc_w1_remove),
 };
-
-static int __init mxc_w1_init(void)
-{
-	return platform_driver_register(&mxc_w1_driver);
-}
-
-static void mxc_w1_exit(void)
-{
-	platform_driver_unregister(&mxc_w1_driver);
-}
-
-module_init(mxc_w1_init);
-module_exit(mxc_w1_exit);
+module_platform_driver(mxc_w1_driver);

 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Freescale Semiconductors Inc");


watchdog: imx2_wdt: disable watchdog timer during low power mode

We should set watchdog timer to be disabled in low power mode,
as there is no service running in background, otherwise, system
will reset unexpected.

Signed-off-by: Anson Huang <1faef5ed8cd3077570919dfede5bec7819b07512@freescale.com>
Acked-by: Shawn Guo <912cf7eb7d8018e2943586ae6657d21fd4e38239@linaro.org>
Reviewed-by: Guenter Roeck <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <5f65f6985de1ebf15dde04e0dc4668211868bafa@iguana.be>

--- drivers/watchdog/imx2_wdt.c
+++ drivers/watchdog/imx2_wdt.c
@@ -2,6 +2,7 @@
  * Watchdog driver for IMX2 and later processors
  *
  *  Copyright (C) 2010 Wolfram Sang, Pengutronix e.K. <w.sang@pengutronix.de>
+ *  Copyright (C) 2014 Freescale Semiconductor, Inc.
  *
  * some parts adapted by similar drivers from Darius Augulis and Vladimir
  * Zapolskiy, additional improvements by Wim Van Sebroeck.
@@ -40,6 +41,7 @@
 #define IMX2_WDT_WCR_WT		(0xFF << 8)	/* -> Watchdog Timeout Field */
 #define IMX2_WDT_WCR_WRE	(1 << 3)	/* -> WDOG Reset Enable */
 #define IMX2_WDT_WCR_WDE	(1 << 2)	/* -> Watchdog Enable */
+#define IMX2_WDT_WCR_WDZST	(1 << 0)	/* -> Watchdog timer Suspend */

 #define IMX2_WDT_WSR		0x02		/* Service Register */
 #define IMX2_WDT_SEQ1		0x5555		/* -> service sequence 1 */
@@ -87,6 +89,8 @@
 {
 	u16 val = __raw_readw(imx2_wdt.base + IMX2_WDT_WCR);

+	/* Suspend timer in low power mode, write once-only */
+	val |= IMX2_WDT_WCR_WDZST;
 	/* Strip the old watchdog Time-Out value */
 	val &= ~IMX2_WDT_WCR_WT;
 	/* Generate reset if WDOG times out */


- remove use_kerberos (-m) option; let the server choose if we need to   do sasl authentication. - add --no_passphrase option - pass authz cert in client_request instead of a separate parameter to   myproxy_handle_authorization

--- myproxy_get_delegation.c
+++ myproxy_get_delegation.c
@@ -25,15 +25,13 @@
 "       -p | --psport          <port #>   Port of the myproxy-server\n"
 "       -a | --authorization   <path>     Use credential for authorization\n"
 "                                         (instead of passphrase)\n"
-#if defined(HAVE_LIBSASL2)
-"       -m | --sasl_mechanism             Use SASL (Kerberos) mechanism for authorization\n"
-#endif
 "       -d | --dn_as_username             Use subject of the authorization\n"
 "                                         credential (or default credential\n"
 "                                         if -a not used) as the default\n"
 "                                         username instead of $LOGNAME\n"
 "       -k | --credname        <name>     Specify credential name\n"
 "       -S | --stdin_pass                 Read passphrase from stdin\n"
+"       -n | --no_passphrase              Don't prompt for passphrase\n"
 "\n";

 struct option long_options[] =
@@ -48,14 +46,14 @@
     {"verbose",                no_argument, NULL, 'v'},
     {"version",                no_argument, NULL, 'V'},
     {"authorization",    required_argument, NULL, 'r'},
-    {"sasl_mechanism",         no_argument, NULL, 'm'},
     {"dn_as_username",         no_argument, NULL, 'd'},
     {"credname",	 required_argument, NULL, 'k'},
     {"stdin_pass",             no_argument, NULL, 'S'},
+    {"no_passphrase",         no_argument, NULL, 'n'},
     {0, 0, 0, 0}
 };

-static char short_options[] = "hus:p:l:t:o:vVa:dk:Sm";
+static char short_options[] = "hus:p:l:t:o:vVa:dk:Sn";

 static char version[] =
 "myproxy-get-delegation version " MYPROXY_VERSION " (" MYPROXY_VERSION_DATE ") "  "\n";
@@ -72,11 +70,10 @@
 #define my_setlinebuf(stream)	setvbuf((stream), (char *) NULL, _IOLBF, 0)

 /* location of delegated proxy */
-char *outputfile = NULL;
-char *creds_to_authorization = NULL;
-int kerberos_to_authorization = 0;
+static char *outputfile = NULL;
 static int dn_as_username = 0;
 static int read_passwd_from_stdin = 0;
+static int use_empty_passwd = 0;

 int
 main(int argc, char *argv[])
@@ -110,11 +107,14 @@
 						GLOBUS_PROXY_FILE_OUTPUT);
     }

-    if ( (creds_to_authorization == NULL) && (kerberos_to_authorization == 0) ){
+    if (!use_empty_passwd) {
        /* Allow user to provide a passphrase */
 	int rval;
 	if (read_passwd_from_stdin) {
-	    rval = myproxy_read_passphrase_stdin(client_request->passphrase, sizeof(client_request->passphrase), NULL);
+	    rval = myproxy_read_passphrase_stdin(
+			   client_request->passphrase,
+			   sizeof(client_request->passphrase),
+			   NULL);
 	} else {
 	    rval = myproxy_read_passphrase(client_request->passphrase,
 					   sizeof(client_request->passphrase),
@@ -128,11 +128,11 @@

     if (client_request->username == NULL) { /* set default username */
 	if (dn_as_username) {
-	    if (creds_to_authorization) {
-		if (ssl_get_base_subject_file(creds_to_authorization,
+	    if (client_request->authzcreds) {
+		if (ssl_get_base_subject_file(client_request->authzcreds,
 					      &client_request->username)) {
 		    fprintf(stderr, "Cannot get subject name from %s\n",
-			    creds_to_authorization);
+			    client_request->authzcreds);
 		    return 1;
 		}
 	    } else {
@@ -153,8 +153,8 @@
 	}
     }

-    if (myproxy_get_delegation(socket_attrs, client_request,
-	    creds_to_authorization, kerberos_to_authorization, server_response, outputfile)!=0) {
+    if (myproxy_get_delegation(socket_attrs, client_request,
+			       server_response, outputfile)!=0) {
 	fprintf(stderr, "Failed to receive a proxy.\n");
 	return 1;
     }
@@ -206,10 +206,10 @@
 	    outputfile = strdup(gnu_optarg);
             break;
 	case 'a':       /* special authorization */
-	    creds_to_authorization = strdup(gnu_optarg);
-	    break;
-	case 'm':       /* user SASL (Kerberos) authorization */
-	    kerberos_to_authorization = 1;
+	    request->authzcreds = strdup(gnu_optarg);
+	    break;
+	case 'n':       /* no passphrase */
+	    use_empty_passwd = 1;
 	    break;
 	case 'v':
 	    myproxy_debug_set_level(1);


Mempool bug fix

Mempool bug fix

--- src/core/bsp_mempool.c
+++ src/core/bsp_mempool.c
@@ -54,13 +54,13 @@
         {
             bsp_free(m);
             bsp_trace_message(BSP_TRACE_CRITICAL, _tag_, "Mempool free list alloc failed");
+
             return NULL;
         }

         m->free_list_size = _BSP_MEMPOOL_FREE_LIST_SIZE;
         m->item_size = item_size;
         bsp_spin_init(&m->lock);
-        bsp_spin_lock(&m->lock);
         if (allocator)
         {
             m->allocator = allocator;
@@ -70,8 +70,6 @@
         {
             m->freer = freer;
         }
-
-        bsp_spin_unlock(&m->lock);
     }
     else
     {
@@ -153,7 +151,7 @@
         while (m->total_free >= m->free_list_size)
         {
             // Enlarge free list
-            void **new_list = bsp_realloc(m->free_list, m->free_list_size * 2);
+            void **new_list = bsp_realloc(m->free_list, m->free_list_size * 2 * sizeof(void *));
             if (new_list)
             {
                 m->free_list = new_list;