ASoC: wcd9310: enhance mbhc button release detection performance

Enhance button release detection performance by adopting dynamic release
threshold adjusting logic.
Button release is now detected more quickly.

Change-Id: I3a2379e10663cf91df671e8a3894b8805d1ccf9c
Signed-off-by: Joonwoo Park <c2ec5539c4473ab294a95eac689618c01a8f4c1f@codeaurora.org>

--- sound/soc/codecs/wcd9310.c
+++ sound/soc/codecs/wcd9310.c
@@ -3687,6 +3687,31 @@
 	return v_hs_max;
 }

+static void tabla_codec_calibrate_rel(struct snd_soc_codec *codec)
+{
+	struct tabla_priv *tabla = snd_soc_codec_get_drvdata(codec);
+
+	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B3_CTL,
+		      tabla->mbhc_data.v_b1_hu & 0xFF);
+	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B4_CTL,
+		      (tabla->mbhc_data.v_b1_hu >> 8) & 0xFF);
+
+	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B5_CTL,
+		      tabla->mbhc_data.v_b1_h & 0xFF);
+	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B6_CTL,
+		      (tabla->mbhc_data.v_b1_h >> 8) & 0xFF);
+
+	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B9_CTL,
+		      tabla->mbhc_data.v_brh & 0xFF);
+	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B10_CTL,
+		      (tabla->mbhc_data.v_brh >> 8) & 0xFF);
+
+	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B11_CTL,
+		      tabla->mbhc_data.v_brl & 0xFF);
+	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B12_CTL,
+		      (tabla->mbhc_data.v_brl >> 8) & 0xFF);
+}
+
 static void tabla_codec_calibrate_hs_polling(struct snd_soc_codec *codec)
 {
 	u8 *n_ready, *n_cic;
@@ -3701,25 +3726,7 @@
 	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B2_CTL,
 		      (v_ins_hu >> 8) & 0xFF);

-	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B3_CTL,
-		      tabla->mbhc_data.v_b1_hu & 0xFF);
-	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B4_CTL,
-		      (tabla->mbhc_data.v_b1_hu >> 8) & 0xFF);
-
-	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B5_CTL,
-		      tabla->mbhc_data.v_b1_h & 0xFF);
-	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B6_CTL,
-		      (tabla->mbhc_data.v_b1_h >> 8) & 0xFF);
-
-	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B9_CTL,
-		      tabla->mbhc_data.v_brh & 0xFF);
-	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B10_CTL,
-		      (tabla->mbhc_data.v_brh >> 8) & 0xFF);
-
-	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B11_CTL,
-		      tabla->mbhc_data.v_brl & 0xFF);
-	snd_soc_write(codec, TABLA_A_CDC_MBHC_VOLT_B12_CTL,
-		      (tabla->mbhc_data.v_brl >> 8) & 0xFF);
+	tabla_codec_calibrate_rel(codec);

 	n_ready = tabla_mbhc_cal_btn_det_mp(btn_det, TABLA_BTN_DET_N_READY);
 	snd_soc_write(codec, TABLA_A_CDC_MBHC_TIMER_B1_CTL,
@@ -5671,15 +5678,55 @@
 	return r;
 }

+static void tabla_mbhc_calc_rel_thres(struct snd_soc_codec *codec, s16 mv)
+{
+	s16 deltamv;
+	struct tabla_priv *tabla;
+	struct tabla_mbhc_btn_detect_cfg *btn_det;
+
+	tabla = snd_soc_codec_get_drvdata(codec);
+	btn_det = TABLA_MBHC_CAL_BTN_DET_PTR(tabla->mbhc_cfg.calibration);
+
+	tabla->mbhc_data.v_b1_h =
+	    tabla_codec_v_sta_dce(codec, DCE,
+				  mv + btn_det->v_btn_press_delta_cic);
+
+	tabla->mbhc_data.v_brh = tabla->mbhc_data.v_b1_h;
+
+	tabla->mbhc_data.v_brl = TABLA_MBHC_BUTTON_MIN;
+
+	deltamv = mv + btn_det->v_btn_press_delta_sta;
+	tabla->mbhc_data.v_b1_hu = tabla_codec_v_sta_dce(codec, STA, deltamv);
+
+	deltamv = mv + btn_det->v_btn_press_delta_cic;
+	tabla->mbhc_data.v_b1_huc = tabla_codec_v_sta_dce(codec, DCE, deltamv);
+}
+
+static void tabla_mbhc_set_rel_thres(struct snd_soc_codec *codec, s16 mv)
+{
+	tabla_mbhc_calc_rel_thres(codec, mv);
+	tabla_codec_calibrate_rel(codec);
+}
+
+static s16 tabla_mbhc_highest_btn_mv(struct snd_soc_codec *codec)
+{
+	struct tabla_priv *tabla;
+	struct tabla_mbhc_btn_detect_cfg *btn_det;
+	u16 *btn_high;
+
+	tabla = snd_soc_codec_get_drvdata(codec);
+	btn_det = TABLA_MBHC_CAL_BTN_DET_PTR(tabla->mbhc_cfg.calibration);
+	btn_high = tabla_mbhc_cal_btn_det_mp(btn_det, TABLA_BTN_DET_V_BTN_HIGH);
+
+	return btn_high[btn_det->num_btn - 1];
+}
+
 static void tabla_mbhc_calc_thres(struct snd_soc_codec *codec)
 {
 	struct tabla_priv *tabla;
-	s16 btn_mv = 0, btn_delta_mv;
 	struct tabla_mbhc_btn_detect_cfg *btn_det;
 	struct tabla_mbhc_plug_type_cfg *plug_type;
-	u16 *btn_high;
 	u8 *n_ready;
-	int i;

 	tabla = snd_soc_codec_get_drvdata(codec);
 	btn_det = TABLA_MBHC_CAL_BTN_DET_PTR(tabla->mbhc_cfg.calibration);
@@ -5730,22 +5777,7 @@
 					     false);
 	}

-	btn_high = tabla_mbhc_cal_btn_det_mp(btn_det, TABLA_BTN_DET_V_BTN_HIGH);
-	for (i = 0; i < btn_det->num_btn; i++)
-		btn_mv = btn_high[i] > btn_mv ? btn_high[i] : btn_mv;
-
-	tabla->mbhc_data.v_b1_h = tabla_codec_v_sta_dce(codec, DCE, btn_mv);
-	btn_delta_mv = btn_mv + btn_det->v_btn_press_delta_sta;
-	tabla->mbhc_data.v_b1_hu =
-	    tabla_codec_v_sta_dce(codec, STA, btn_delta_mv);
-
-	btn_delta_mv = btn_mv + btn_det->v_btn_press_delta_cic;
-
-	tabla->mbhc_data.v_b1_huc =
-	    tabla_codec_v_sta_dce(codec, DCE, btn_delta_mv);
-
-	tabla->mbhc_data.v_brh = tabla->mbhc_data.v_b1_h;
-	tabla->mbhc_data.v_brl = TABLA_MBHC_BUTTON_MIN;
+	tabla_mbhc_calc_rel_thres(codec, tabla_mbhc_highest_btn_mv(codec));

 	tabla->mbhc_data.v_no_mic =
 	    tabla_codec_v_sta_dce(codec, STA, plug_type->v_no_mic);
@@ -5906,6 +5938,7 @@
 	short dce, sta;
 	s32 mv, mv_s, stamv_s;
 	bool vddio;
+	u16 *btn_high;
 	int btn = -1, meas = 0;
 	struct tabla_priv *priv = data;
 	const struct tabla_mbhc_btn_detect_cfg *d =
@@ -5918,6 +5951,7 @@

 	pr_debug("%s: enter\n", __func__);

+	btn_high = tabla_mbhc_cal_btn_det_mp(d, TABLA_BTN_DET_V_BTN_HIGH);
 	TABLA_ACQUIRE_LOCK(priv->codec_resource_lock);
 	if (priv->mbhc_state == MBHC_STATE_POTENTIAL_RECOVERY) {
 		pr_debug("%s: mbhc is being recovered, skip button press\n",
@@ -6010,6 +6044,8 @@
 				 "press\n", __func__);
 			goto done;
 		}
+		/* narrow down release threshold */
+		tabla_mbhc_set_rel_thres(codec, btn_high[btn]);
 		mask = tabla_get_button_mask(btn);
 		priv->buttons_pressed |= mask;
 		wcd9xxx_lock_sleep(core);
@@ -6115,6 +6151,8 @@
 		priv->buttons_pressed &= ~TABLA_JACK_BUTTON_MASK;
 	}

+	/* revert narrowed release threshold */
+	tabla_mbhc_calc_rel_thres(codec, tabla_mbhc_highest_btn_mv(codec));
 	tabla_codec_calibrate_hs_polling(codec);

 	if (priv->mbhc_cfg.gpio)


FIX - send notification fix

FIX - send notification fix

--- core/system/notification/notification_manager_web.c
+++ core/system/notification/notification_manager_web.c
@@ -323,36 +323,36 @@
 		}

 		el = HttpGetPOSTParameter( request, "channelid" );
-		if( el != NULL )
+		if( el != NULL && el->hme_Data )
 		{
 			channelid = UrlDecodeToMem( el->hme_Data );
 		}

 		el = HttpGetPOSTParameter( request, "app" );
-		if( el != NULL )
+		if( el != NULL && el->hme_Data )
 		{
 			app = UrlDecodeToMem( el->hme_Data );
 		}

 		el = HttpGetPOSTParameter( request, "title" );
-		if( el != NULL )
+		if( el != NULL && el->hme_Data )
 		{
 			title = UrlDecodeToMem( el->hme_Data );
 		}

 		el = HttpGetPOSTParameter( request, "message" );
-		if( el != NULL )
+		if( el != NULL && el->hme_Data )
 		{
 			message = UrlDecodeToMem( el->hme_Data );
 		}

 		el = HttpGetPOSTParameter( request, "extra" );
-		if( el != NULL )
+		if( el != NULL && el->hme_Data )
 		{
 			extra = UrlDecodeToMem( el->hme_Data );
 		}

-		if( username == NULL || channelid == NULL || app == NULL || title == NULL || message == NULL )
+		if( username != NULL && channelid != NULL && app != NULL && title != NULL && message != NULL )
 		{
 			int error = MobileAppNotifyUserRegister( l, username, channelid, app, title, message, type, extra, time(NULL) );


Correct the DCR_IPE macro to refer to the right bit. Also improve the associated comment as besides US-IV+ these bits are only available with US-III++, i.e. the 1.2GHz version of the US-III+.


io/uart: reorder uart_divisor members

io/uart: reorder uart_divisor members


Correcting number of chars in WP6 Charset 13 (Smokey Ardisson)

--- src/lib/WP6FileStructure.h
+++ src/lib/WP6FileStructure.h
@@ -374,7 +374,7 @@
 #define WP6_NUM_HEBREW_CHARACTERS 115
 #define WP6_NUM_CYRILLIC_CHARACTERS 250
 #define WP6_NUM_JAPANESE_CHARACTERS 63
-#define WP6_NUM_ARABIC_CHARACTERS 184
+#define WP6_NUM_ARABIC_CHARACTERS 196
 #define WP6_NUM_ARABIC_SCRIPT_CHARACTERS 220

 /* Undo Group */


ASoC: wm_hubs: Rename calibrate_dc_servo()

Really we're enabling it here and the name will become very confusing
shortly.

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>


Clean up orientation measurement.

Clean up orientation measurement.

--- inc/osvr/Kalman/AbsoluteOrientationMeasurement.h
+++ inc/osvr/Kalman/AbsoluteOrientationMeasurement.h
@@ -67,15 +67,9 @@
             // This is not actually what the above comment describes - that was
             // giving too
             // small of values. This is a wild guess.
-            m_covariance(3, 3) = m_eulerVariance.sum() / 4.;
+            m_covariance(3, 3) = m_eulerVariance.sum();
 #endif
         }
-#if 0
-        AbsoluteOrientationBase(
-            Eigen::Quaterniond const &quat,
-            types::SquareMatrix<DIMENSION> const &covariance)
-            : m_measurement(quat), m_covariance(covariance) {}
-#endif

         template <typename State>
         MeasurementSquareMatrix const &getCovariance(State const &s) {
@@ -134,12 +128,6 @@
         AbsoluteOrientationMeasurement(Eigen::Quaterniond const &quat,
                                        types::Vector<3> const &eulerVariance)
             : Base(quat, eulerVariance) {}
-#if 0
-        AbsoluteOrientationMeasurement(
-            Eigen::Quaterniond const &quat,
-            types::SquareMatrix<DIMENSION> const &covariance)
-            : Base(quat, covariance) {}
-#endif

         types::Matrix<DIMENSION, STATE_DIMENSION>
         getJacobian(State const &s) const {


Comment two values I was looking at for GDB.


remove unneeded semi-colon

remove unneeded semi-colon

git-svn-id: 6d771e449150288cc513807b7f4d2af31e9482bd@47529 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/cache/evas_cache.h
+++ src/lib/cache/evas_cache.h
@@ -37,7 +37,7 @@
    int          (*color_space)(Image_Entry *dst, int cspace);

    /* This function need to update im->w and im->h. */
-   int          (*load)(Image_Entry *im);; /**< return is EVAS_LOAD_ERROR_* or EVAS_LOAD_ERROR_NONE! */
+   int          (*load)(Image_Entry *im); /**< return is EVAS_LOAD_ERROR_* or EVAS_LOAD_ERROR_NONE! */
    int          (*mem_size_get)(Image_Entry *im);
    void         (*debug)(const char *context, Image_Entry *im);
 };


Don't use a VOP_*() function on our own vnodes, go directly to the relevant internal function, in this case ufs_bmaparray().


dump show percentages.

dump show percentages.

not that useful, but I like it.

git-svn-id: a6113611d365f0fc061992be0d1d0b451b434026@37253 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/lib/eina_stringshare.c
+++ src/lib/eina_stringshare.c
@@ -997,8 +997,11 @@
    di.saved += population_group[1].count * sizeof(char) * 2;
 #endif
    printf("DDD:-------------------\n");
-   printf("DDD: usage (bytes) = %i, saved = %i (%i duplicates, %i unique)\n",
-	  di.used, di.saved, di.dups, di.unique);
+   printf("DDD: usage (bytes) = %i, saved = %i (%3.0f%%)\n",
+	  di.used, di.saved, di.used ? (di.saved * 100.0 / di.used) : 0.0);
+   printf("DDD: unique: %d, duplicates: %d (%3.0f%%)\n",
+	  di.unique, di.dups, di.unique ? (di.dups * 100.0 / di.unique) : 0.0);
+
 #ifdef EINA_STRINGSHARE_USAGE
    printf("DDD: Allocated strings: %i\n", population.count);
    printf("DDD: Max allocated strings: %i\n", population.max);


warn--

warn--

SVN revision: 58468

--- src/lib/elm_diskselector.c
+++ src/lib/elm_diskselector.c
@@ -186,15 +186,6 @@
    str = edje_object_data_get(wd->right_blank, "min_height");
    if (str) wd->minh = MAX(-1, atoi(str));
    else wd->minh = -1;
-}
-
-static void
-_default_display_item_num_set(Widget_Data *wd)
-{
-   const char* str;
-   str = edje_object_data_get(wd->right_blank, "display_item_num");
-   if (str) wd->display_item_num = MAX(DISPLAY_ITEM_NUM_MIN, atoi(str));
-   else wd->display_item_num = DISPLAY_ITEM_NUM_MIN;
 }

 static void


istream-seekable: Fail stat() if stream_errno is set.

--- src/lib/istream-seekable.c
+++ src/lib/istream-seekable.c
@@ -330,6 +330,8 @@
 		i_stream_seek(&stream->istream, old_offset);
 		unref_streams(sstream);
 	}
+	if (stream->istream.stream_errno != 0)
+		return -1;

 	if (sstream->fd_input != NULL) {
 		/* using a file backed buffer, we can use real fstat() */


Suppress unused var warning

Suppress unused var warning

--- t/maxminddb_test_helper.c
+++ t/maxminddb_test_helper.c
@@ -35,7 +35,7 @@
 const char *test_database_path(const char *filename)
 {
     char cwd[500];
-    char *tmp = getcwd(cwd, 500);
+    char *UNUSED(tmp) = getcwd(cwd, 500);

     char *test_db_dir;
     if (strcmp(basename(cwd), "t") == 0) {


drm/gf110/gr: fixup gpc/tpc initvals lists

Differences noted vs traces.

Signed-off-by: Ben Skeggs <d9f27fb07c1e9f131223ad827fa5179f3846c30b@redhat.com>


perf probe: Use %td for pointer arithmetic result

%td is for ptrdiff_t, avoiding this warning on 32-bit:

cc1: warnings being treated as errors
builtin-probe.c: In function ‘opt_set_filter’:
builtin-probe.c:176:4: error: format ‘%ld’ expects type ‘long int’, but
argument 3 has type ‘int’

Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Cc: Masami Hiramatsu <60fcdccfd958d359debfe6e6e7417cd7f1aaa9e3@hitachi.com>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Stephane Eranian <f199ae9781930a5b94b284ca2f471140752002a7@google.com>
Cc: Tom Zanussi <ca42f6846873622f2a6dc51a5106ba83ffbdaf95@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/builtin-probe.c
+++ tools/perf/builtin-probe.c
@@ -173,7 +173,7 @@
 			strfilter__delete(params.filter);
 		params.filter = strfilter__new(str, &err);
 		if (!params.filter) {
-			pr_err("Filter parse error at %ld.\n", err - str + 1);
+			pr_err("Filter parse error at %td.\n", err - str + 1);
 			pr_err("Source: \"%s\"\n", str);
 			pr_err("         %*c\n", (int)(err - str + 1), '^');
 			return -EINVAL;


perf trace: Hide sys_exit messages about syscall id = -1

That was reproduced via ftrace as described in this cset comment log,
need to investigate further.

Cc: Adrian Hunter <41bb5944f244750b7cf0394140496972a3f1bee3@intel.com>
Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Stephane Eranian <f199ae9781930a5b94b284ca2f471140752002a7@google.com>
Link: 639f103dd2cdcfdbba9d4125a8991a777448f31b@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/builtin-trace.c
+++ tools/perf/builtin-trace.c
@@ -298,7 +298,22 @@
 	int id = perf_evsel__intval(evsel, sample, "id");

 	if (id < 0) {
-		fprintf(trace->output, "Invalid syscall %d id, skipping...\n", id);
+
+		/*
+		 * XXX: Noticed on x86_64, reproduced as far back as 3.0.36, haven't tried
+		 * before that, leaving at a higher verbosity level till that is
+		 * explained. Reproduced with plain ftrace with:
+		 *
+		 * echo 1 > /t/events/raw_syscalls/sys_exit/enable
+		 * grep "NR -1 " /t/trace_pipe
+		 *
+		 * After generating some load on the machine.
+ 		 */
+		if (verbose > 1) {
+			static u64 n;
+			fprintf(trace->output, "Invalid syscall %d id, skipping (%s, %" PRIu64 ") ...\n",
+				id, perf_evsel__name(evsel), ++n);
+		}
 		return NULL;
 	}


perf trace: Handle MSG_WAITFORONE not defined

Needed for compiles on Fedora 12 for example.

Signed-off-by: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Link: http://lkml.kernel.org/r/1379900700-5186-2-git-send-email-b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/builtin-trace.c
+++ tools/perf/builtin-trace.c
@@ -362,6 +362,9 @@

 #ifndef MSG_PROBE
 #define MSG_PROBE	     0x10
+#endif
+#ifndef MSG_WAITFORONE
+#define MSG_WAITFORONE	0x10000
 #endif
 #ifndef MSG_SENDPAGE_NOTLAST
 #define MSG_SENDPAGE_NOTLAST 0x20000


perf tools: Fix segfault for symbol annotation on TUI

Currently the symbol structure is allocated with symbol_conf.priv_size
to carry sideband information like annotation, map browser on TUI and
sort-by-name tree node.  So retrieving these information from symbol
needs to care about the details of such placement.

However the annotation code just assumes that the symbol is placed after
the struct annotation.  But actually there's other info between them.
So accessing those struct will lead to an undefined behavior (usually a
crash) after they write their info to the same location.

To reproduce the problem, please follow the steps below:

  1. run perf report (TUI of course) with -v option
  2. open map browser (by pressing right arrow key for any entry)
  3. search any function (by pressing '/' key and input whatever..)
  4. return to the hist browser (by pressing 'q' or left arrow key)
  5. open annotation window for the same entry (by pressing 'a' key)

Signed-off-by: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>
Cc: Jiri Olsa <2c6594f608aa3d41e98d48846a6328831f7084ad@redhat.com>
Cc: Masami Hiramatsu <60fcdccfd958d359debfe6e6e7417cd7f1aaa9e3@hitachi.com>
Cc: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Link: http://lkml.kernel.org/r/1421234288-22758-1-git-send-email-5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/util/annotate.h
+++ tools/perf/util/annotate.h
@@ -116,11 +116,6 @@
 	struct annotated_source *src;
 };

-struct sannotation {
-	struct annotation annotation;
-	struct symbol	  symbol;
-};
-
 static inline struct sym_hist *annotation__histogram(struct annotation *notes, int idx)
 {
 	return (((void *)&notes->src->histograms) +
@@ -129,8 +124,7 @@

 static inline struct annotation *symbol__annotation(struct symbol *sym)
 {
-	struct sannotation *a = container_of(sym, struct sannotation, symbol);
-	return &a->annotation;
+	return (void *)sym - symbol_conf.priv_size;
 }

 int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, int evidx);


Update the copyright notice

Update the copyright notice

--- tests/stdio.c
+++ tests/stdio.c
@@ -1,5 +1,5 @@
 /* $Id$ */
-/* Copyright (c) 2012-2014 Pierre Pronchery <khorben@defora.org> */
+/* Copyright (c) 2012-2015 Pierre Pronchery <khorben@defora.org> */
 /* This file is part of DeforaOS System libc */
 /* All rights reserved.
  *


ACPICA: Add FADT error message for GAS BitWidth overflow

Error for possible overflow during conversion from 32-bit legacy
register addresses to GAS format. The GAS struct contains a
one-byte BitWidth field, meaning that the maximum length of a
register is 255 bits. ACPICA BZ 953.

https://www.acpica.org/bugzilla/show_bug.cgi?id=953

Signed-off-by: Bob Moore <861d61e839a6c9cacf88c3a26b10371d2c9b211f@intel.com>
Signed-off-by: Lin Ming <d6f051473f553588884d51874952f6fb19ae8261@intel.com>
Signed-off-by: Len Brown <b060cfa1096cc6e8be83699ddb4ed8a77dd63af5@intel.com>

--- drivers/acpi/acpica/tbfadt.c
+++ drivers/acpi/acpica/tbfadt.c
@@ -49,9 +49,10 @@
 ACPI_MODULE_NAME("tbfadt")

 /* Local prototypes */
-static ACPI_INLINE void
+static void
 acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
-			     u8 space_id, u8 byte_width, u64 address);
+			     u8 space_id,
+			     u8 byte_width, u64 address, char *register_name);

 static void acpi_tb_convert_fadt(void);

@@ -182,10 +183,25 @@
  *
  ******************************************************************************/

-static ACPI_INLINE void
+static void
 acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
-			     u8 space_id, u8 byte_width, u64 address)
+			     u8 space_id,
+			     u8 byte_width, u64 address, char *register_name)
 {
+	u8 bit_width;
+
+	/* Bit width field in the GAS is only one byte long, 255 max */
+
+	bit_width = (u8)(byte_width * 8);
+
+	if (byte_width > 31) {	/* (31*8)=248 */
+		ACPI_ERROR((AE_INFO,
+			    "%s - 32-bit FADT register is too long (%u bytes, %u bits) "
+			    "to convert to GAS struct - 255 bits max, truncating",
+			    register_name, byte_width, (byte_width * 8)));
+
+		bit_width = 255;
+	}

 	/*
 	 * The 64-bit Address field is non-aligned in the byte packed
@@ -196,7 +212,7 @@
 	/* All other fields are byte-wide */

 	generic_address->space_id = space_id;
-	generic_address->bit_width = (u8)ACPI_MUL_8(byte_width);
+	generic_address->bit_width = bit_width;
 	generic_address->bit_offset = 0;
 	generic_address->access_width = 0;	/* Access width ANY */
 }
@@ -456,7 +472,8 @@
 								   &acpi_gbl_FADT,
 								   fadt_info_table
 								   [i].length),
-						     (u64) address32);
+						     (u64) address32,
+						     fadt_info_table[i].name);
 		}
 	}
 }
@@ -670,7 +687,8 @@
 						     source64->address +
 						     (fadt_pm_info_table[i].
 						      register_num *
-						      pm1_register_byte_width));
+						      pm1_register_byte_width),
+						     "PmRegisters");
 		}
 	}
 }


cleanup

cleanup

--- src/jbl/jbl.c
+++ src/jbl/jbl.c
@@ -125,18 +125,6 @@
   return rc;
 }

-IW_INLINE int _jbl_utf8_ch_len(uint8_t ch) {
-  if (!(ch & 0x80)) return 1;
-  switch (ch & 0xf0) {
-    case 0xf0:
-      return 4;
-    case 0xe0:
-      return 3;
-    default:
-      return 2;
-  }
-}
-
 iwrc _jbl_write_double(double num, jbl_json_printer pt, void *op) {
   char buf[IWFTOA_BUFSIZE];
   iwftoa(num, buf);
@@ -147,13 +135,6 @@
   char buf[JBNUMBUF_SIZE];
   int sz = iwitoa(num, buf, sizeof(buf));
   return pt(buf, sz, 0, 0, op);
-}
-
-IW_INLINE int _jbl_hex(char c) {
-  if (c >= '0' && c <= '9') return c - '0';
-  if (c >= 'a' && c <= 'f') return c - 'a' + 10;
-  if (c >= 'A' && c <= 'F') return c - 'A' + 10;
-  return -1;
 }

 iwrc _jbl_write_string(const char *str, size_t len, jbl_json_printer pt, void *op, jbl_print_flags_t pf) {


Fixed compiling on systems without MAP_ANONYMOUS For example OSX.

--- src/lib/test-hash-method.c
+++ src/lib/test-hash-method.c
@@ -3,6 +3,10 @@
 #include "test-lib.h"
 #include "mmap-util.h"
 #include "hash-method.h"
+
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#  define MAP_ANONYMOUS MAP_ANON
+#endif

 static unsigned char *buf;
 static unsigned int buf_size;
@@ -33,9 +37,13 @@
 	unsigned int i;

 	buf_size = mmap_get_page_size();
+#ifdef MAP_ANONYMOUS
 	buf = mmap(NULL, buf_size*2, PROT_READ | PROT_WRITE,
 		   MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	mprotect(buf + buf_size, buf_size, PROT_NONE);
+#else
+	buf = i_malloc(buf_size);
+#endif
 	memset(buf, 0, buf_size);

 	for (i = 0; hash_methods[i] != NULL; i++)


regmap: Reset cache status when reinitialsing the cache

When we reinitialise the cache make sure that we reset the cache access
flags, ensuring that the reinitialised cache is in the default state
which is what callers would and do expect given the function name.

This is particularly likely to cause issues in systems where there was no
cache previously as those systems have cache bypass enabled, as for the
wm8994 driver where this was noticed.

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- drivers/base/regmap/regmap.c
+++ drivers/base/regmap/regmap.c
@@ -284,6 +284,9 @@
 	map->precious_reg = config->precious_reg;
 	map->cache_type = config->cache_type;

+	map->cache_bypass = false;
+	map->cache_only = false;
+
 	ret = regcache_init(map, config);

 	mutex_unlock(&map->lock);


regmap: Clean up _regmap_update_bits()

regmap: Clean up _regmap_update_bits()

Since sometimes the 'config' parameter has no use, it should be NULL.
And make the code simplifier.

Signed-off-by: Xiubo Li <cf2f21a5d63bafab3dac1a48e01d31cd0b77ab89@freescale.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>

--- drivers/base/regmap/regmap.c
+++ drivers/base/regmap/regmap.c
@@ -1969,9 +1969,11 @@

 	if (tmp != orig) {
 		ret = _regmap_write(map, reg, tmp);
-		*change = true;
+		if (change)
+			*change = true;
 	} else {
-		*change = false;
+		if (change)
+			*change = false;
 	}

 	return ret;
@@ -1990,11 +1992,10 @@
 int regmap_update_bits(struct regmap *map, unsigned int reg,
 		       unsigned int mask, unsigned int val)
 {
-	bool change;
 	int ret;

 	map->lock(map->lock_arg);
-	ret = _regmap_update_bits(map, reg, mask, val, &change);
+	ret = _regmap_update_bits(map, reg, mask, val, NULL);
 	map->unlock(map->lock_arg);

 	return ret;
@@ -2019,14 +2020,13 @@
 int regmap_update_bits_async(struct regmap *map, unsigned int reg,
 			     unsigned int mask, unsigned int val)
 {
-	bool change;
 	int ret;

 	map->lock(map->lock_arg);

 	map->async = true;

-	ret = _regmap_update_bits(map, reg, mask, val, &change);
+	ret = _regmap_update_bits(map, reg, mask, val, NULL);

 	map->async = false;


xen-blkfront: If no barrier or flush is supported, use invalid operation.

Guard against issuing BLKIF_OP_WRITE_BARRIER or BLKIF_OP_FLUSH_CACHE
by checking whether we successfully negotiated with the backend.
The negotiation with the backend also sets the q->flush_flags which
fortunately for us is also used when submitting an bio to us. If
we don't support barriers or flushes it would be set to zero so
we should never end up having to deal with REQ_FLUSH | REQ_FUA.

However, other third party implementations of __make_request that
might be stacked on top of us might not be so smart, so lets fix this up.

Acked-by: Jan Beulich <01de09643e0ae62e116f8bd77de435799874b456@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <da3a51b335cef0eb0e2c329c5ef6bcd6acef687a@oracle.com>

--- drivers/block/xen-blkfront.c
+++ drivers/block/xen-blkfront.c
@@ -380,7 +380,9 @@

 		blk_start_request(req);

-		if (req->cmd_type != REQ_TYPE_FS) {
+		if ((req->cmd_type != REQ_TYPE_FS) ||
+		    ((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
+		    !info->flush_op)) {
 			__blk_end_request_all(req, -EIO);
 			continue;
 		}


agp: remove flush_agp_mappings calls from new flush handling code

Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@linux.ie>

--- drivers/char/agp/intel-agp.c
+++ drivers/char/agp/intel-agp.c
@@ -597,7 +597,6 @@
 	kunmap(intel_private.i8xx_page);
 	intel_private.i8xx_flush_page = NULL;
 	unmap_page_from_agp(intel_private.i8xx_page);
-	flush_agp_mappings();

 	__free_page(intel_private.i8xx_page);
 	intel_private.i8xx_page = NULL;
@@ -615,7 +614,6 @@

 	/* make page uncached */
 	map_page_into_agp(intel_private.i8xx_page);
-	flush_agp_mappings();

 	intel_private.i8xx_flush_page = kmap(intel_private.i8xx_page);
 	if (!intel_private.i8xx_flush_page)


Fix for analysis of "don't care" variables. The previous check
to prevent DC variables from appearing in the rule head was
both buggy (didn't recurse into expression trees), and too late:
we've already tried to type check the expressions in the head
by that point, and DC variables in the head don't have their
types filled-in.

Hence, generalize the "inside_qual" code to a trinary "ExprLocation"
value, and use that to catch DC variables in either the head or
a qual as part of analyze_expr().

--- src/libc4/parser/analyze.c
+++ src/libc4/parser/analyze.c
@@ -30,18 +30,28 @@
     int tmp_varno;
 } AnalyzeState;

-
-static void analyze_table_ref(AstTableRef *ref, AnalyzeState *state);
+/*
+ * In what location does an expression appear? Certain constructs (e.g. don't
+ * care variables) are legal in join clauses but not elsewhere, for example.
+ */
+typedef enum ExprLocation
+{
+    EXPR_LOC_HEAD,
+    EXPR_LOC_JOIN,
+    EXPR_LOC_QUAL
+} ExprLocation;
+
+static void analyze_table_ref(AstTableRef *ref, ExprLocation loc, AnalyzeState *state);
 static void analyze_join_clause(AstJoinClause *join, AstRule *rule,
                                 AnalyzeState *state);
 static void analyze_qualifier(AstQualifier *qual, AnalyzeState *state);
-static void analyze_expr(C4Node *node, bool inside_qual, AnalyzeState *state);
-static void analyze_op_expr(AstOpExpr *op_expr, bool inside_qual,
+static void analyze_expr(C4Node *node, ExprLocation loc, AnalyzeState *state);
+static void analyze_op_expr(AstOpExpr *op_expr, ExprLocation loc,
                             AnalyzeState *state);
-static void analyze_var_expr(AstVarExpr *var_expr, bool inside_qual,
+static void analyze_var_expr(AstVarExpr *var_expr, ExprLocation loc,
                              AnalyzeState *state);
 static void analyze_const_expr(AstConstExpr *c_expr, AnalyzeState *state);
-static void analyze_agg_expr(AstAggExpr *a_expr, AnalyzeState *state);
+static void analyze_agg_expr(AstAggExpr *a_expr, ExprLocation loc, AnalyzeState *state);
 static void analyze_rule_location(AstRule *rule, AnalyzeState *state);

 static void find_unused_vars(AstRule *rule, AnalyzeState *state);
@@ -176,15 +186,7 @@
     }

     /* Check the rule head */
-    analyze_table_ref(rule->head, state);
-    foreach (lc, rule->head->cols)
-    {
-        AstColumnRef *col = (AstColumnRef *) lc_ptr(lc);
-
-        if (is_dont_care_var(col->expr))
-            ERROR("Don't care variables (\"_\") cannot "
-                  "appear in the head of a rule");
-    }
+    analyze_table_ref(rule->head, EXPR_LOC_HEAD, state);

     make_var_eq_table(rule, state);
     make_implied_quals(rule, state);
@@ -354,8 +356,7 @@
     if (tbl_def != NULL)
         return tbl_def->ls_colno;

-    define = apr_hash_get(state->define_tbl, tbl_name,
-                          APR_HASH_KEY_STRING);
+    define = apr_hash_get(state->define_tbl, tbl_name, APR_HASH_KEY_STRING);

     colno = 0;
     foreach (lc, define->schema)
@@ -547,7 +548,7 @@
         colno++;
     }

-    analyze_table_ref(join->ref, state);
+    analyze_table_ref(join->ref, EXPR_LOC_JOIN, state);
 }

 static void
@@ -571,7 +572,7 @@
 {
     DataType type;

-    analyze_expr(qual->expr, true, state);
+    analyze_expr(qual->expr, EXPR_LOC_QUAL, state);

     type = expr_get_type(qual->expr);
     if (type != TYPE_BOOL)
@@ -580,16 +581,16 @@
 }

 static void
-analyze_expr(C4Node *node, bool inside_qual, AnalyzeState *state)
+analyze_expr(C4Node *node, ExprLocation loc, AnalyzeState *state)
 {
     switch (node->kind)
     {
         case AST_OP_EXPR:
-            analyze_op_expr((AstOpExpr *) node, inside_qual, state);
+            analyze_op_expr((AstOpExpr *) node, loc, state);
             break;

         case AST_VAR_EXPR:
-            analyze_var_expr((AstVarExpr *) node, inside_qual, state);
+            analyze_var_expr((AstVarExpr *) node, loc, state);
             break;

         case AST_CONST_EXPR:
@@ -597,7 +598,7 @@
             break;

         case AST_AGG_EXPR:
-            analyze_agg_expr((AstAggExpr *) node, state);
+            analyze_agg_expr((AstAggExpr *) node, loc, state);
             break;

         default:
@@ -606,12 +607,12 @@
 }

 static void
-analyze_op_expr(AstOpExpr *op_expr, bool inside_qual, AnalyzeState *state)
+analyze_op_expr(AstOpExpr *op_expr, ExprLocation loc, AnalyzeState *state)
 {
     DataType lhs_type;
     DataType rhs_type;

-    analyze_expr(op_expr->lhs, inside_qual, state);
+    analyze_expr(op_expr->lhs, loc, state);
     lhs_type = expr_get_type(op_expr->lhs);

     /* Unary operators are simple */
@@ -623,7 +624,7 @@
         return;
     }

-    analyze_expr(op_expr->rhs, inside_qual, state);
+    analyze_expr(op_expr->rhs, loc, state);
     rhs_type = expr_get_type(op_expr->rhs);

     /* XXX: type compatibility check is far too strict */
@@ -648,18 +649,21 @@
 }

 static void
-analyze_var_expr(AstVarExpr *var_expr, bool inside_qual, AnalyzeState *state)
+analyze_var_expr(AstVarExpr *var_expr, ExprLocation loc, AnalyzeState *state)
 {
     if (is_dont_care_var((C4Node *) var_expr))
     {
-        if (inside_qual)
+        if (loc == EXPR_LOC_QUAL)
             ERROR("Don't care variables (\"_\") cannot be "
                   "referenced in qualifiers");
+        if (loc == EXPR_LOC_HEAD)
+            ERROR("Don't care variables (\"_\") cannot appear "
+                  "in the head of a rule");

         /*
-         * If we're not inside a qual, we're done: we don't want to lookup
-         * the variable's name, and don't care variables in join clauses or
-         * rule heads have already had their type computed.
+         * For don't care variables in join clauses, we're done: we don't want
+         * to lookup the variable's name, and we should have already computed
+         * the variable's type.
          */
         ASSERT(var_expr->type != TYPE_INVALID);
         return;
@@ -692,9 +696,9 @@
 }

 static void
-analyze_agg_expr(AstAggExpr *a_expr, AnalyzeState *state)
-{
-    analyze_expr(a_expr->expr, false, state);
+analyze_agg_expr(AstAggExpr *a_expr, ExprLocation loc, AnalyzeState *state)
+{
+    analyze_expr(a_expr->expr, loc, state);

     if (a_expr->agg_kind == AST_AGG_SUM &&
         expr_get_type(a_expr->expr) != TYPE_INT8)
@@ -707,7 +711,7 @@
     AstTableRef *target = fact->head;
     ListCell *lc;

-    analyze_table_ref(target, state);
+    analyze_table_ref(target, EXPR_LOC_HEAD, state);

     foreach (lc, target->cols)
     {
@@ -719,7 +723,7 @@
 }

 static void
-analyze_table_ref(AstTableRef *ref, AnalyzeState *state)
+analyze_table_ref(AstTableRef *ref, ExprLocation loc, AnalyzeState *state)
 {
     int num_cols;
     ListCell *lc;
@@ -747,7 +751,7 @@
         DataType expr_type;
         DataType schema_type;

-        analyze_expr(col->expr, false, state);
+        analyze_expr(col->expr, loc, state);
         expr_type = expr_get_type(col->expr);
         schema_type = table_get_col_type(ref->name, colno, state);


[PATCH] Off-by-one in drivers/char/mwave/mwavedd.c

This fixes two off by ones in the mwave driver, found
via find -iname \*.[ch] | xargs grep "> ARRAY_SIZE("

Signed-off-by: Eric Sesterhenn <86caaff84c57abceb7fdae007cf6db060e3716da@gmx.de>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/char/mwave/mwavedd.c
+++ drivers/char/mwave/mwavedd.c
@@ -297,7 +297,7 @@
 				" ipcnum %x, usIntCount %x\n",
 				ipcnum,
 				pDrvData->IPCs[ipcnum].usIntCount);
-			if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+			if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
 				PRINTK_ERROR(KERN_ERR_MWAVE
 						"mwavedd::mwave_ioctl:"
 						" IOCTL_MW_GET_IPC: Error:"
@@ -355,7 +355,7 @@
 				"mwavedd::mwave_ioctl IOCTL_MW_UNREGISTER_IPC"
 				" ipcnum %x\n",
 				ipcnum);
-			if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+			if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
 				PRINTK_ERROR(KERN_ERR_MWAVE
 						"mwavedd::mwave_ioctl:"
 						" IOCTL_MW_UNREGISTER_IPC:"


ruToken-ECP: in compute-signature procedure limit Le to 256 bytes ...

so that the APDU can pass the validity check

git-svn-id: 444ed946b9c2220da791e84c3dd156a05f92db99@5455 c6295689-39f2-0310-b995-f0e70906c6a9

--- src/libopensc/card-rtecp.c
+++ src/libopensc/card-rtecp.c
@@ -365,7 +365,7 @@
 	apdu.datalen = data_len;
 	apdu.resp = buf_out;
 	apdu.resplen = out_len + 2;
-	apdu.le = out_len;
+	apdu.le = out_len > 256 ? 256 : out_len;
 	if (apdu.lc > 255)
 		apdu.flags |= SC_APDU_FLAGS_CHAINING;
 	r = sc_transmit_apdu(card, &apdu);


clocksource: sh_tmu: Drop support for legacy platform data

Now that all platforms have switched to the new-style platform data,
drop support for the legacy version.

Signed-off-by: Laurent Pinchart <ae960578cc5eca7b9b1dbc37d9caa6cb634f35e0@ideasonboard.com>
Tested-by: Simon Horman <9662bddcc379be37df16f02a449c344b4718c1a1@verge.net.au>

--- drivers/clocksource/sh_tmu.c
+++ drivers/clocksource/sh_tmu.c
@@ -32,7 +32,6 @@
 #include <linux/spinlock.h>

 enum sh_tmu_model {
-	SH_TMU_LEGACY,
 	SH_TMU,
 	SH_TMU_SH3,
 };
@@ -91,8 +90,6 @@

 	if (reg_nr == TSTR) {
 		switch (ch->tmu->model) {
-		case SH_TMU_LEGACY:
-			return ioread8(ch->tmu->mapbase);
 		case SH_TMU_SH3:
 			return ioread8(ch->tmu->mapbase + 2);
 		case SH_TMU:
@@ -115,8 +112,6 @@

 	if (reg_nr == TSTR) {
 		switch (ch->tmu->model) {
-		case SH_TMU_LEGACY:
-			return iowrite8(value, ch->tmu->mapbase);
 		case SH_TMU_SH3:
 			return iowrite8(value, ch->tmu->mapbase + 2);
 		case SH_TMU:
@@ -476,27 +471,12 @@
 		return 0;

 	ch->tmu = tmu;
-
-	if (tmu->model == SH_TMU_LEGACY) {
-		struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
-
-		/*
-		 * The SH3 variant (SH770x, SH7705, SH7710 and SH7720) maps
-		 * channel registers blocks at base + 2 + 12 * index, while all
-		 * other variants map them at base + 4 + 12 * index. We can
-		 * compute the index by just dividing by 12, the 2 bytes or 4
-		 * bytes offset being hidden by the integer division.
-		 */
-		ch->index = cfg->channel_offset / 12;
-		ch->base = tmu->mapbase + cfg->channel_offset;
-	} else {
-		ch->index = index;
-
-		if (tmu->model == SH_TMU_SH3)
-			ch->base = tmu->mapbase + 4 + ch->index * 12;
-		else
-			ch->base = tmu->mapbase + 8 + ch->index * 12;
-	}
+	ch->index = index;
+
+	if (tmu->model == SH_TMU_SH3)
+		ch->base = tmu->mapbase + 4 + ch->index * 12;
+	else
+		ch->base = tmu->mapbase + 8 + ch->index * 12;

 	ch->irq = platform_get_irq(tmu->pdev, index);
 	if (ch->irq < 0) {
@@ -526,26 +506,7 @@
 	if (tmu->mapbase == NULL)
 		return -ENXIO;

-	/*
-	 * In legacy platform device configuration (with one device per channel)
-	 * the resource points to the channel base address.
-	 */
-	if (tmu->model == SH_TMU_LEGACY) {
-		struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
-		tmu->mapbase -= cfg->channel_offset;
-	}
-
 	return 0;
-}
-
-static void sh_tmu_unmap_memory(struct sh_tmu_device *tmu)
-{
-	if (tmu->model == SH_TMU_LEGACY) {
-		struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
-		tmu->mapbase += cfg->channel_offset;
-	}
-
-	iounmap(tmu->mapbase);
 }

 static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
@@ -564,8 +525,7 @@
 	tmu->model = id->driver_data;

 	/* Get hold of clock. */
-	tmu->clk = clk_get(&tmu->pdev->dev,
-			   tmu->model == SH_TMU_LEGACY ? "tmu_fck" : "fck");
+	tmu->clk = clk_get(&tmu->pdev->dev, "fck");
 	if (IS_ERR(tmu->clk)) {
 		dev_err(&tmu->pdev->dev, "cannot get clock\n");
 		return PTR_ERR(tmu->clk);
@@ -583,10 +543,7 @@
 	}

 	/* Allocate and setup the channels. */
-	if (tmu->model == SH_TMU_LEGACY)
-		tmu->num_channels = 1;
-	else
-		tmu->num_channels = hweight8(cfg->channels_mask);
+	tmu->num_channels = hweight8(cfg->channels_mask);

 	tmu->channels = kzalloc(sizeof(*tmu->channels) * tmu->num_channels,
 				GFP_KERNEL);
@@ -595,23 +552,15 @@
 		goto err_unmap;
 	}

-	if (tmu->model == SH_TMU_LEGACY) {
-		ret = sh_tmu_channel_setup(&tmu->channels[0], 0,
-					   cfg->clockevent_rating != 0,
-					   cfg->clocksource_rating != 0, tmu);
+	/*
+	 * Use the first channel as a clock event device and the second channel
+	 * as a clock source.
+	 */
+	for (i = 0; i < tmu->num_channels; ++i) {
+		ret = sh_tmu_channel_setup(&tmu->channels[i], i,
+					   i == 0, i == 1, tmu);
 		if (ret < 0)
 			goto err_unmap;
-	} else {
-		/*
-		 * Use the first channel as a clock event device and the second
-		 * channel as a clock source.
-		 */
-		for (i = 0; i < tmu->num_channels; ++i) {
-			ret = sh_tmu_channel_setup(&tmu->channels[i], i,
-						   i == 0, i == 1, tmu);
-			if (ret < 0)
-				goto err_unmap;
-		}
 	}

 	platform_set_drvdata(pdev, tmu);
@@ -620,7 +569,7 @@

 err_unmap:
 	kfree(tmu->channels);
-	sh_tmu_unmap_memory(tmu);
+	iounmap(tmu->mapbase);
 err_clk_unprepare:
 	clk_unprepare(tmu->clk);
 err_clk_put:
@@ -671,7 +620,6 @@
 }

 static const struct platform_device_id sh_tmu_id_table[] = {
-	{ "sh_tmu", SH_TMU_LEGACY },
 	{ "sh-tmu", SH_TMU },
 	{ "sh-tmu-sh3", SH_TMU_SH3 },
 	{ }


gpio/gpio-tps65910: gpio_chip.of_node referenced without CONFIG_OF_GPIO defined

commit 626f9914 added code to initialize gpio_chip.of_node, but if
CONFIG_OF_GPIO is not defined gps-tps65910 fails to build with an
error complaining gpio_chip has no member of_node. I ran into this
while doing a allyesconfig build on linux-next.

Signed-off-by: Gerard Snitselaar <34c6fceca75e456f25e7e99531e2425c6c1de443@snitselaar.org>
Signed-off-by: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>

--- drivers/gpio/gpio-tps65910.c
+++ drivers/gpio/gpio-tps65910.c
@@ -149,7 +149,9 @@
 	tps65910_gpio->gpio_chip.set	= tps65910_gpio_set;
 	tps65910_gpio->gpio_chip.get	= tps65910_gpio_get;
 	tps65910_gpio->gpio_chip.dev = &pdev->dev;
+#ifdef CONFIG_OF_GPIO
 	tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node;
+#endif
 	if (pdata && pdata->gpio_base)
 		tps65910_gpio->gpio_chip.base = pdata->gpio_base;
 	else


gpio: langwell_gpio: irq_data conversion

Converts irq_chips and flow handlers over to the new struct irq_data based
irq_chip functions.

Signed-off-by: Lennert Buytenhek <8858498612e3a522354216649776e3032dcb7e5b@secretlab.ca>
Cc: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@linux.intel.com>
Cc: Yin Kangkai <0938115889365b3bb160586d6797f118917586da@intel.com>
Cc: Alek Du <f955007a45bbce7554bdd01ef2474bb68f93b1ee@intel.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/gpio/langwell_gpio.c
+++ drivers/gpio/langwell_gpio.c
@@ -134,10 +134,10 @@
 	return lnw->irq_base + offset;
 }

-static int lnw_irq_type(unsigned irq, unsigned type)
-{
-	struct lnw_gpio *lnw = get_irq_chip_data(irq);
-	u32 gpio = irq - lnw->irq_base;
+static int lnw_irq_type(struct irq_data *d, unsigned type)
+{
+	struct lnw_gpio *lnw = irq_data_get_irq_chip_data(d);
+	u32 gpio = d->irq - lnw->irq_base;
 	unsigned long flags;
 	u32 value;
 	void __iomem *grer = gpio_reg(&lnw->chip, gpio, GRER);
@@ -162,19 +162,19 @@
 	return 0;
 }

-static void lnw_irq_unmask(unsigned irq)
-{
-}
-
-static void lnw_irq_mask(unsigned irq)
+static void lnw_irq_unmask(struct irq_data *d)
+{
+}
+
+static void lnw_irq_mask(struct irq_data *d)
 {
 }

 static struct irq_chip lnw_irqchip = {
 	.name		= "LNW-GPIO",
-	.mask		= lnw_irq_mask,
-	.unmask		= lnw_irq_unmask,
-	.set_type	= lnw_irq_type,
+	.irq_mask	= lnw_irq_mask,
+	.irq_unmask	= lnw_irq_unmask,
+	.irq_set_type	= lnw_irq_type,
 };

 static DEFINE_PCI_DEVICE_TABLE(lnw_gpio_ids) = {   /* pin number */


drm/tegra: hdmi: Implement ->atomic_check()

The implementation of the ->atomic_check() callback precomputes all
parameters to check if the given configuration can be applied. If so the
precomputed values are stored in the atomic state object for the encoder
and applied during modeset. In that way the modeset no longer needs to
perform any checking but simply program values into registers.

Signed-off-by: Thierry Reding <3055038c414aef68bf32c33b8118623e7554e0f2@nvidia.com>

--- drivers/gpu/drm/tegra/hdmi.c
+++ drivers/gpu/drm/tegra/hdmi.c
@@ -1081,6 +1081,27 @@
 	}
 }

+static int
+tegra_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
+				struct drm_crtc_state *crtc_state,
+				struct drm_connector_state *conn_state)
+{
+	struct tegra_output *output = encoder_to_output(encoder);
+	struct tegra_dc *dc = to_tegra_dc(conn_state->crtc);
+	unsigned long pclk = crtc_state->mode.clock * 1000;
+	struct tegra_hdmi *hdmi = to_hdmi(output);
+	int err;
+
+	err = tegra_dc_state_setup_clock(dc, crtc_state, hdmi->clk_parent,
+					 pclk, 0);
+	if (err < 0) {
+		dev_err(output->dev, "failed to setup CRTC state: %d\n", err);
+		return err;
+	}
+
+	return err;
+}
+
 static const struct drm_encoder_helper_funcs tegra_hdmi_encoder_helper_funcs = {
 	.dpms = tegra_hdmi_encoder_dpms,
 	.mode_fixup = tegra_hdmi_encoder_mode_fixup,
@@ -1088,6 +1109,7 @@
 	.commit = tegra_hdmi_encoder_commit,
 	.mode_set = tegra_hdmi_encoder_mode_set,
 	.disable = tegra_hdmi_encoder_disable,
+	.atomic_check = tegra_hdmi_encoder_atomic_check,
 };

 static int tegra_hdmi_show_regs(struct seq_file *s, void *data)


qup_i2c: Manage gpio configuration from runtime pm

Due to gpio_request and gpio_free calls are made from
multiple places in i2c driver code and can cause erroneous
condition where same gpios are assigned/freed multiple times.

Move the gpio reques/free calls under runtime pm to
manage better.

CRs-Fixed: 432971
Change-Id: Ic44202e0743fa56806a0612243d3b800bad1433f
Signed-off-by: Alok Chauhan <a781eab460d0b8de6413720f3ae4346867408d60@codeaurora.org>

--- drivers/i2c/busses/i2c-qup.c
+++ drivers/i2c/busses/i2c-qup.c
@@ -163,7 +163,7 @@
 	int                          wr_sz;
 	struct msm_i2c_platform_data *pdata;
 	int                          suspended;
-	int                          clk_state;
+	int                          pwr_state;
 	struct mutex                 mlock;
 	void                         *complete;
 	int                          i2c_gpios[ARRAY_SIZE(i2c_rsrcs)];
@@ -327,7 +327,7 @@
 static void
 qup_i2c_pwr_mgmt(struct qup_i2c_dev *dev, unsigned int state)
 {
-	dev->clk_state = state;
+	dev->pwr_state = state;
 	if (state != 0) {
 		clk_prepare_enable(dev->clk);
 		if (!dev->pdata->keep_ahb_clk_on)
@@ -1228,10 +1228,6 @@
 		dev->i2c_gpios[i] = res ? res->start : -1;
 	}

-	ret = qup_i2c_request_gpios(dev);
-	if (ret)
-		goto err_request_gpio_failed;
-
 	platform_set_drvdata(pdev, dev);

 	dev->one_bit_t = (USEC_PER_SEC/pdata->clk_freq) + 1;
@@ -1313,7 +1309,7 @@
 		pdata->msm_i2c_config_gpio(dev->adapter.nr, 1);

 	mutex_init(&dev->mlock);
-	dev->clk_state = 0;
+	dev->pwr_state = 0;
 	/* If the same AHB clock is used on Modem side
 	 * switch it on here itself and don't switch it
 	 * on and off during suspend and resume.
@@ -1343,13 +1339,11 @@

 err_request_irq_failed:
-	qup_i2c_free_gpios(dev);
 	if (dev->gsbi)
 		iounmap(dev->gsbi);
 err_reset_failed:
 	clk_disable_unprepare(dev->clk);
 	clk_disable_unprepare(dev->pclk);
-err_request_gpio_failed:
 err_gsbi_failed:
 	iounmap(dev->base);
 err_ioremap_failed:
@@ -1380,8 +1374,10 @@
 	dev->suspended = 1;
 	mutex_unlock(&dev->mlock);
 	mutex_destroy(&dev->mlock);
-	if (dev->clk_state != 0)
+	if (dev->pwr_state != 0) {
 		qup_i2c_pwr_mgmt(dev, 0);
+		qup_i2c_free_gpios(dev);
+	}
 	platform_set_drvdata(pdev, NULL);
 	if (dev->num_irqs == 3) {
 		free_irq(dev->out_irq, dev);
@@ -1393,7 +1389,6 @@
 		clk_put(dev->pclk);
 	}
 	clk_put(dev->clk);
-	qup_i2c_free_gpios(dev);
 	if (dev->gsbi)
 		iounmap(dev->gsbi);
 	iounmap(dev->base);
@@ -1425,9 +1420,10 @@
 	mutex_lock(&dev->mlock);
 	dev->suspended = 1;
 	mutex_unlock(&dev->mlock);
-	if (dev->clk_state != 0)
+	if (dev->pwr_state != 0) {
 		qup_i2c_pwr_mgmt(dev, 0);
-	qup_i2c_free_gpios(dev);
+		qup_i2c_free_gpios(dev);
+	}
 	return 0;
 }

@@ -1435,10 +1431,14 @@
 {
 	struct platform_device *pdev = to_platform_device(device);
 	struct qup_i2c_dev *dev = platform_get_drvdata(pdev);
+	int ret = 0;
 	dev_dbg(device, "pm_runtime: resuming...\n");
-	BUG_ON(qup_i2c_request_gpios(dev) != 0);
-	if (dev->clk_state == 0)
+	if (dev->pwr_state == 0) {
+		ret = qup_i2c_request_gpios(dev);
+		if (ret != 0)
+			return ret;
 		qup_i2c_pwr_mgmt(dev, 1);
+	}
 	dev->suspended = 0;
 	return 0;
 }
@@ -1454,11 +1454,15 @@

 static int qup_i2c_resume(struct device *device)
 {
+	int ret = 0;
 	if (!pm_runtime_enabled(device) || !pm_runtime_suspended(device)) {
 		dev_dbg(device, "system resume");
-		i2c_qup_pm_resume_runtime(device);
-		pm_runtime_mark_last_busy(device);
-		pm_request_autosuspend(device);
+		ret = i2c_qup_pm_resume_runtime(device);
+		if (!ret) {
+			pm_runtime_mark_last_busy(device);
+			pm_request_autosuspend(device);
+		}
+		return ret;
 	}
 	return 0;
 }


Descripción del automata parseada - aún falta parsear los nodos

--- yaml_parser.c
+++ yaml_parser.c
@@ -1,16 +1,16 @@
 /*
-USAR cc -o name yaml_parser.c -lyaml
-LUEGO ./name file.yaml
-
-cc yaml_parser.c -lyaml
-gcc yaml_parser.c -lyaml
-gcc -o name yaml_parser.c -lyaml
-./name file.yaml
-
-poner dentro del make CFLAGS="-I/usr/include/glib-2.0'
-cc `pkg-config --libs --cflags glib-2.0` -o parser yaml_parser.c -lyaml
-pkg-config --list-all | grep glib-2.0
-sudo apt-get install libglib2.0-dev
+  USAR cc -o name yaml_parser.c -lyaml
+  LUEGO ./name file.yaml
+
+  cc yaml_parser.c -lyaml
+  gcc yaml_parser.c -lyaml
+  gcc -o name yaml_parser.c -lyaml
+  ./name file.yaml
+
+  poner dentro del make CFLAGS="-I/usr/include/glib-2.0'
+  cc `pkg-config --libs --cflags glib-2.0` -o parser yaml_parser.c -lyaml
+  pkg-config --list-all | grep glib-2.0
+  sudo apt-get install libglib2.0-dev
 */
 #include "yaml.h"
 // definido en yaml.h por lo que no son necesarios
@@ -27,24 +27,28 @@
 #define SYSTEM_SUCCESS 0
 #define SYSTEM_ERROR 1
 #define FILE_ERROR 0
-#define ALPHA_NUMBER 20
+#define ALPHA_NUMBER 200
+#define STATES_NUMBER 200
+#define NUM_CHARS 10
 #define FIN_YAML 0
 #define NO_FIN_YAML 1
-// #define AUTOMATA 0
-// #define DESCRIPTION 1
-// #define ALPHA 2
-// #define STATES 3
-// #define START 4
-// #define FINAL 5
-// #define DELTA 6
-// #define NODE 7
-// #define TRANS 8
-// #define IN 9
-// #define NEXT 10
+/*
+  #define AUTOMATA 0
+  #define DESCRIPTION 1
+  #define ALPHA 2
+  #define STATES 3
+  #define START 4
+  #define FINAL 5
+  #define DELTA 6
+  #define NODE 7
+  #define TRANS 8
+  #define IN 9
+  #define NEXT 10
+*/

 // TAGS para determinar el diccionario
 enum tags {
-  AUTOMATA = 0,
+  AUTOMATA,
   DESCRIPTION,
   ALPHA,
   STATES,
@@ -54,7 +58,7 @@
   NODE,
   TRANS,
   IN,
-  NEXT = 10
+  NEXT
 };

 typedef enum tags tag;
@@ -63,12 +67,12 @@
 void startSequence();
 void startMapping();
 // void parseDescriptionSection(yaml_parser_t parser, yaml_event_t event);
-void parseDescriptionSection(yaml_event_t event, yaml_parser_t parser);
+void parseDescriptionSection(yaml_event_t *event, yaml_parser_t *parser);
 // el ... significa que resive atributos dinamicos
-void parseSequenceSection(yaml_event_t event, yaml_parser_t parser, int kind, ...);
-int deleteEvent(yaml_event_t event);
-void yamlParser(yaml_event_t event, yaml_parser_t parser);
-void next(yaml_event_t event, yaml_parser_t parser);
+void parseSequenceSection(yaml_event_t *event, yaml_parser_t *parser, int kind, ...);
+int deleteEvent(yaml_event_t *event);
+void yamlParser(yaml_event_t *event, yaml_parser_t *parser);
+void next(yaml_event_t *event, yaml_parser_t *parser);

 struct flujo_nodos{
@@ -79,18 +83,23 @@
 struct transicion_nodos {
     GSList* flujo_nodos;
 };
+
 struct nodo_automata{
     char id;
     GSList* transicion_nodos;
 };
+
 struct automata_desc{
     char *nombre;
     char *descripcion;
     char **alfabeto;
+    int sizeAlfabeto;
     char **estados;
-    char *inicio;
+    int sizeEstados;
+    char *estadoinicial;
     char **final;
-    GSList* nodo_automata;
+    int sizeFinal;
+    GSList* nodos_automata;
 };

 typedef struct automata_desc automata;
@@ -101,6 +110,33 @@
 typedef struct flujo_nodos* p_type_flujo;
 typedef struct transicion_nodos transicion;
 typedef struct transicion_nodos* p_type_transicion;
+
+void automata_descPrinter(p_type_automata *pautomata){
+  fprintf(stdout, "Nombre Automata: %s\n", (*pautomata)->nombre);
+  fprintf(stdout, "Descripcion: %s\n", (*pautomata)->descripcion);
+  // array of strings
+  fprintf(stdout, "Alfabeto: \n");
+  int i = 0;
+  while(i < (*pautomata)->sizeAlfabeto){
+    fprintf(stdout, ":\t\n",(*pautomata)->alfabeto[i]);
+    ++i;
+  }
+  i = 0;
+  // array of strings
+  fprintf(stdout, "Estados: \n");
+  while(i < (*pautomata)->sizeEstados){
+    fprintf(stdout, ":\t\n",(*pautomata)->estados[i]);
+    ++i;
+  }
+  i = 0;
+  fprintf(stdout, "Estado Inicial: %s\n", (*pautomata)->estadoinicial);
+  // array of strings
+  fprintf(stdout, "Estados Finales: \n");
+  while(i < (*pautomata)->sizeFinal){
+    fprintf(stdout, ":\t\n",(*pautomata)->final[i]);
+    ++i;
+  }
+}

 // diccionario de TAGS  en el archivo yaml
 char *diccionario[11] = {
@@ -116,45 +152,62 @@
   "in",
   "next"
 };
-void yamlParser(yaml_event_t event, yaml_parser_t parser){
-  // parsea el archivo y setea el evento en el proximo evento, si devuelve 0 es porque hubo
-  // un error
-  if( !yaml_parser_parse(&parser, &event) )
+
+void yamlParser(yaml_event_t *event, yaml_parser_t *parser){
+  if( !yaml_parser_parse(parser, event) )
   {
-     printf("Parser Error %d\n", parser.error);
+     printf("Parser Error %d\n", (*parser).error);
      exit(EXIT_FAILURE);
   }
 }
+
+// si el evento es diferente que fin de archivo elimino el evento para despues seguir
+// con el siguiente y retorno 1 si se pudo eliminar para poder continuar, de lo contrario
+// retorno 0, es decir que se acabo el yaml
+int deleteEvent(yaml_event_t *event) {
+  if ( (*event).type != YAML_STREAM_END_EVENT )
+  {
+      yaml_event_delete( event );
+      return NO_FIN_YAML;
+  }
+  return FIN_YAML;
+}
+
 // pregunto si es fin de archivo, si lo es hubo un erro, sino sigo con el siguiente evento
-void next(yaml_event_t event, yaml_parser_t parser){
-  if( !deleteEvent(event) )
+void next(yaml_event_t *event, yaml_parser_t *parser){
+  if( !deleteEvent( event ) )
       exit(EXIT_FAILURE);
   yamlParser(event, parser);
 }
-void parseSequenceSection(yaml_event_t event, yaml_parser_t parser, int kind, ...){
+
+void parseSequenceSection(yaml_event_t *event, yaml_parser_t *parser, int kind, ...){
     // lista de argumentos dinamicos
     va_list args;
     // inicializar lista de argumentos con los elementos que vayan despues de kind
     va_start ( args, kind );
+    char *data = NULL;
     switch(kind)
     {
       case ALPHA:
-      { //scope for ALPHAcase http://stackoverflow.com/questions/92396/why-cant-variables-be-declared-in-a-switch-statement
+      { //scope for ALPHA case http://stackoverflow.com/questions/92396/why-cant-variables-be-declared-in-a-switch-statement
           // sacar el elemento de la lista suponiendo que tiene que del tipo del segundo argumento
           p_type_automata pautomata = va_arg( args, p_type_automata );
+          fprintf(stdout, "in SEQUENCE ALPHA Section\n");
           // alfabeto de maximo 20 strings
           char *alfabeto[ALPHA_NUMBER];
-          char *data = NULL;
           int pos_alfab = 0;
           next(event, parser);
-          while(event.type == YAML_SCALAR_EVENT) {
-              data = (char *)event.data.scalar.value;
+          while((*event).type == YAML_SCALAR_EVENT) {
+              data = (char *)(*event).data.scalar.value;
+              fprintf(stdout, "\t%s\n", data);
               alfabeto[pos_alfab] = data;
               ++pos_alfab;
+              next(event, parser);
           }
           if( !pos_alfab)
               exit(EXIT_FAILURE);
           pautomata->alfabeto = alfabeto;
+          pautomata->sizeAlfabeto = pos_alfab + 1;
           break;
       }
       case STATES:
@@ -162,49 +215,95 @@
           // p_type_nodo pnodo = va_arg( args, p_type_nodo );
           // sacar el elemento de la lista suponiendo que tiene que del tipo del segundo argumento
           p_type_automata pautomata = va_arg( args, p_type_automata );
+          fprintf(stdout, "in SEQUENCE STATES Section\n");
+          char *estados[STATES_NUMBER];
+          int pos_alfab = 0;
+          next(event, parser);
+          while((*event).type == YAML_SCALAR_EVENT) {
+              data = (char *)(*event).data.scalar.value;
+              fprintf(stdout, "\t%s\n", data);
+              estados[pos_alfab] = data;
+              ++pos_alfab;
+              next(event, parser);
+          }
+          if( !pos_alfab)
+              exit(EXIT_FAILURE);
+          pautomata->estados = estados;
+          pautomata->sizeEstados = pos_alfab + 1;
           break;
+      }
+      case FINAL:
+      {
+        p_type_automata pautomata = va_arg( args, p_type_automata );
+        fprintf(stdout, "in SEQUENCE FINAL Section\n");
+        char *posiblesFinales[STATES_NUMBER];
+        int pos_alfab = 0;
+        next(event, parser);
+        while((*event).type == YAML_SCALAR_EVENT) {
+            data = (char *)(*event).data.scalar.value;
+            fprintf(stdout, "\t%s\n", data);
+            posiblesFinales[pos_alfab] = data;
+            ++pos_alfab;
+            next(event, parser);
+        }
+        if( !pos_alfab)
+            exit(EXIT_FAILURE);
+        pautomata->final = posiblesFinales;
+        pautomata->sizeFinal = pos_alfab + 1;
+        break;
       }
     }
     va_end ( args );
 }
-void parseDescriptionSection(yaml_event_t event, yaml_parser_t parser) {
-  char *data = event.data.scalar.value;
+
+void parseDescriptionSection(yaml_event_t *event, yaml_parser_t *parser) {
+  char *data = (*event).data.scalar.value;
   p_type_automata pautomata = (p_type_automata)  malloc( sizeof( automata ) );
+  pautomata->nombre = (char *) malloc(sizeof(char) * NUM_CHARS);
+  pautomata->descripcion = (char *) malloc(sizeof(char) * NUM_CHARS);
+  pautomata->estadoinicial = (char *) malloc(sizeof(char) * NUM_CHARS);
+  pautomata->alfabeto = (char **)malloc(sizeof(char)*STATES_NUMBER);
+  pautomata->estados = (char **)malloc(sizeof(char)*STATES_NUMBER);
+  pautomata->final = (char **)malloc(sizeof(char)*STATES_NUMBER);
   // si el dato es = automata pido el siguiente evento que debe de ser el nombre del automata
+  fprintf(stdout, "AUTOMATA\n");
   if (strcmp( data, diccionario[AUTOMATA] ) == 0) {
       /* code */
       // if( !deleteEvent(event) )
       //   exit(EXIT_FAILURE);
       // yamlParser(event, parser);
       next(event, parser);
-      pautomata->nombre = event.data.scalar.value;
+      strcpy(pautomata->nombre, (*event).data.scalar.value);
+      fprintf(stdout, "\t%s\n", pautomata->nombre);
   }
   // el siguiente evento debe de ser la descripcion
   next(event, parser);
-  data = event.data.scalar.value;
+  data = (*event).data.scalar.value;
+  fprintf(stdout, "DESCRIPTION\n");
   if (strcmp( data, diccionario[DESCRIPTION] ) == 0) {
       /* code */
       next(event, parser);
-      pautomata->descripcion = event.data.scalar.value;
+      strcpy(pautomata->descripcion, (*event).data.scalar.value);
+      fprintf(stdout, "\t%s\n", pautomata->descripcion);
   }
   // el siguiente evento debe de ser el alfabeto, el cual contiene una secuencia donde
   // los caracteres estan encerrados en forma de arreglo
   next(event, parser);
-  data = event.data.scalar.value;
+  data = (*event).data.scalar.value;
+  fprintf(stdout, "ALPHA\n");
   if (strcmp( data, diccionario[ALPHA] ) == 0) {
     /* code */
     // el siguiente evento debe de ser una secuencia de letras que componen al alfabeto
     next(event, parser);
-    switch (event.type)
+    switch ((*event).type)
     {
       /* code */
       case YAML_SEQUENCE_START_EVENT:
           // parseo esa secuencia la cual se ve como una seccion
-          parseSequenceSection(event, parser, ALPHA, pautomata);
+          parseSequenceSection(event, parser, ALPHA, &pautomata);
           // luego de haber parseado la secuencia debe de seguir fin de secuencia, sino
           // es porque hay un error
-          next(event, parser);
-          if (event.type != YAML_SEQUENCE_END_EVENT)
+          if ((*event).type != YAML_SEQUENCE_END_EVENT)
             exit(EXIT_FAILURE);
           break;
     }
@@ -212,39 +311,50 @@
   // el siguiente evento tiene que ser los estados que tendra el automata, que tambien
   // poseen una secuencia donde tiene todos los estados como letras, leer alfabeto
   next(event, parser);
-  data = event.data.scalar.value;
+  data = (*event).data.scalar.value;
+  fprintf(stdout, "STATES\n");
   if (strcmp( data, diccionario[STATES] ) == 0) {
     /* code */
     next(event, parser);
-    switch (event.type)
+    switch ((*event).type)
     {
       /* code */
       case YAML_SEQUENCE_START_EVENT:
-          parseSequenceSection(event, parser, STATES, pautomata);
-          next(event, parser);
-          if (event.type != YAML_SEQUENCE_END_EVENT)
+          parseSequenceSection(event, parser, STATES, &pautomata);
+          if ((*event).type != YAML_SEQUENCE_END_EVENT)
             exit(EXIT_FAILURE);
           break;
     }
   }
+  next(event, parser);
+  data = (*event).data.scalar.value;
+  fprintf(stdout, "START\n");
   if (strcmp( data, diccionario[START] ) == 0) {
     /* code */
-  }
+    next(event, parser);
+    // fprintf(stdout, "\t%s\n",  (*event).data.scalar.value);
+    strcpy(pautomata->estadoinicial, (*event).data.scalar.value);
+    fprintf(stdout, "\t%s\n", pautomata->estadoinicial);
+  }
+  next(event, parser);
+  data = (*event).data.scalar.value;
+  fprintf(stdout, "FINAL\n");
   if (strcmp( data, diccionario[FINAL] ) == 0) {
     /* code */
-  }
-}
-
-// si el evento es diferente que fin de archivo elimino el evento para despues seguir
-// con el siguiente y retorno 1 si se pudo eliminar para poder continuar, de lo contrario
-// retorno 0, es decir que se acabo el yaml
-int deleteEvent(yaml_event_t event) {
-  if ( event.type != YAML_STREAM_END_EVENT )
-  {
-      yaml_event_delete( &event );
-      return NO_FIN_YAML;
-  }
-  return FIN_YAML;
+    next(event, parser);
+    switch ((*event).type)
+    {
+      /* code */
+      case YAML_SEQUENCE_START_EVENT:
+          parseSequenceSection(event, parser, FINAL, &pautomata);
+          if ((*event).type != YAML_SEQUENCE_END_EVENT)
+            exit(EXIT_FAILURE);
+          break;
+    }
+  }
+  fprintf(stdout, "Before print\n");
+  automata_descPrinter(&pautomata);
+  fprintf(stdout, "After print\n");
 }

 void startParsingYamlFile(yaml_parser_t *parser) {
@@ -258,14 +368,14 @@
   do
   {
       // if( yaml_parser_parse(&parser, &event) == 0 )
-      yamlParser(event, *parser);
-      // if( !yaml_parser_parse(parser, &event) )
-      // {
-      //    printf("Parser Error %d\n", (*parser).error);
-      //    exit(EXIT_FAILURE);
-      // }
-      printf("EVENT TYPE: %d\n",event.type);
-      switch(event.type)
+      // yamlParser(event, *parser);
+      if( !yaml_parser_parse(parser, &event) )
+      {
+         printf("Parser Error %d\n", (*parser).error);
+         exit(EXIT_FAILURE);
+      }
+      printf("EVENT TYPE: %d\n",(event).type);
+      switch((event).type)
       {
           case YAML_STREAM_START_EVENT:
               ++streamCounter;
@@ -300,16 +410,17 @@
               // printf("MAPPING END: %s\n",event.data.mapping_start.anchor );
               break;
           case YAML_SCALAR_EVENT:
-              // printf("YAML VALUE: %s\n", event.data.scalar.value);
-              parseDescriptionSection( event, *parser );
+              printf("YAML VALUE: %s\n", event.data.scalar.value);
+              parseDescriptionSection( &event, parser );
               break;
       }
-      deleteEvent(event);
-      // if ( event.type != YAML_STREAM_END_EVENT )
+      deleteEvent(&event);
+      // if ( (*event).type != YAML_STREAM_END_EVENT )
       // {
       //     yaml_event_delete( &event );
       // }
-  } while (event.type != YAML_STREAM_END_TOKEN);
+  } while ((event).type != YAML_STREAM_END_TOKEN);
+  yaml_event_delete( &event );
 }

 int main(int argc, char const *argv[])


input: sensors: add enable and poll_delay handle for cm36283 sensor driver

Add enable and poll_delay handle functions for the cm36283 light and
proximity sensor driver. The system will create the general enable and
poll_delay handles in the "/sys/class/sensors/xxx/" for each sensor
drvier which is using the sensor class driver.

Change-Id: Ib8503a60991577737b372f512bb07b064319ce35
Signed-off-by: Oliver Wang <bba47ad64dee34c4d300854848a6414e05073f51@codeaurora.org>

--- drivers/input/misc/cm36283.c
+++ drivers/input/misc/cm36283.c
@@ -3,7 +3,7 @@
  * Copyright (C) 2012 Capella Microsystems Inc.
  * Author: Frank Hsieh <pengyueh@gmail.com>
  *
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -74,6 +74,10 @@
 	.min_delay = 0,
 	.fifo_reserved_event_count = 0,
 	.fifo_max_event_count = 0,
+	.enabled = 0,
+	.delay_msec = CM36283_LS_DEFAULT_POLL_DELAY,
+	.sensors_enable = NULL,
+	.sensors_poll_delay = NULL,
 };

 static struct sensors_classdev sensors_proximity_cdev = {
@@ -88,6 +92,10 @@
 	.min_delay = 0,
 	.fifo_reserved_event_count = 0,
 	.fifo_max_event_count = 0,
+	.enabled = 0,
+	.delay_msec = CM36283_PS_DEFAULT_POLL_DELAY,
+	.sensors_enable = NULL,
+	.sensors_poll_delay = NULL,
 };

@@ -158,6 +166,8 @@
 	struct regulator *vio;
 	struct delayed_work ldwork;
 	struct delayed_work pdwork;
+	struct sensors_classdev als_cdev;
+	struct sensors_classdev ps_cdev;
 };
 struct cm36283_info *lp_info;
 int fLevel=-1;
@@ -805,6 +815,21 @@
 	return ret;
 }

+static int ps_enable_set(struct sensors_classdev *sensors_cdev,
+		unsigned int enable)
+{
+	struct cm36283_info *lpi = container_of(sensors_cdev,
+			struct cm36283_info, ps_cdev);
+	int ret;
+
+	if (enable)
+		ret = psensor_enable(lpi);
+	else
+		ret = psensor_disable(lpi);
+
+	return ret;
+}
+
 static ssize_t ps_enable_store(struct device *dev,
 				struct device_attribute *attr,
 				const char *buf, size_t count)
@@ -959,6 +984,27 @@
 		lpi->current_adc, lpi->current_level);

 	return ret;
+}
+
+static int ls_enable_set(struct sensors_classdev *sensors_cdev,
+		unsigned int enable)
+{
+	struct cm36283_info *lpi = container_of(sensors_cdev,
+			struct cm36283_info, als_cdev);
+	int ret;
+
+	if (enable)
+		ret = lightsensor_enable(lpi);
+	else
+		ret = lightsensor_disable(lpi);
+
+	if (ret < 0) {
+		dev_err(&lpi->i2c_client->dev, "%s: set auto light sensor fail\n",
+				__func__);
+		return -EIO;
+	}
+
+	return 0;
 }

 static ssize_t ls_enable_show(struct device *dev,
@@ -1002,9 +1048,11 @@
 			lpi->ls_calibrate);
 	dev_dbg(&lpi->i2c_client->dev, "ls_auto:0x%x\n", ls_auto);

-	if (ret < 0)
+	if (ret < 0) {
 		dev_err(&lpi->i2c_client->dev, "%s: set auto light sensor fail\n",
 		__func__);
+		return ret;
+	}

 	return count;
 }
@@ -1187,6 +1235,21 @@
 	return count;
 }

+static int ls_poll_delay_set(struct sensors_classdev *sensors_cdev,
+		unsigned int delay_msec)
+{
+	struct cm36283_info *lpi = container_of(sensors_cdev,
+			struct cm36283_info, als_cdev);
+
+	if ((delay_msec < CM36283_LS_MIN_POLL_DELAY) ||
+			(delay_msec > CM36283_LS_MAX_POLL_DELAY))
+		return -EINVAL;
+
+	atomic_set(&lpi->ls_poll_delay, delay_msec);
+
+	return 0;
+}
+
 static ssize_t ps_poll_delay_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
@@ -1210,6 +1273,20 @@

 	atomic_set(&lpi->ps_poll_delay, (unsigned int) interval_ms);
 	return count;
+}
+
+static int ps_poll_delay_set(struct sensors_classdev *sensors_cdev,
+		unsigned int delay_msec)
+{
+	struct cm36283_info *lpi = container_of(sensors_cdev,
+			struct cm36283_info, als_cdev);
+
+	if ((delay_msec < CM36283_PS_MIN_POLL_DELAY) ||
+			(delay_msec > CM36283_PS_MAX_POLL_DELAY))
+		return -EINVAL;
+
+	atomic_set(&lpi->ps_poll_delay, delay_msec);
+	return 0;
 }

 static ssize_t ls_fLevel_show(struct device *dev,
@@ -1644,12 +1721,21 @@
 		goto err_light_sysfs_cleanup;
 	}

-
-	ret = sensors_classdev_register(&client->dev, &sensors_light_cdev);
+	lpi->als_cdev = sensors_light_cdev;
+	lpi->als_cdev.sensors_enable = ls_enable_set;
+	lpi->als_cdev.sensors_poll_delay = ls_poll_delay_set;
+	lpi->als_cdev.min_delay = CM36283_LS_MIN_POLL_DELAY * 1000;
+
+	lpi->ps_cdev = sensors_proximity_cdev;
+	lpi->ps_cdev.sensors_enable = ps_enable_set;
+	lpi->ps_cdev.sensors_poll_delay = ps_poll_delay_set;
+	lpi->ps_cdev.min_delay = CM36283_PS_MIN_POLL_DELAY * 1000;
+
+	ret = sensors_classdev_register(&client->dev, &lpi->als_cdev);
 	if (ret)
 		goto err_proximity_sysfs_cleanup;

-	ret = sensors_classdev_register(&client->dev, &sensors_proximity_cdev);
+	ret = sensors_classdev_register(&client->dev, &lpi->ps_cdev);
 	if (ret)
 		goto err_create_class_sysfs;

@@ -1660,7 +1746,7 @@

 	return ret;
 err_create_class_sysfs:
-	sensors_classdev_unregister(&sensors_light_cdev);
+	sensors_classdev_unregister(&lpi->als_cdev);
 err_proximity_sysfs_cleanup:
 	remove_sysfs_interfaces(&lpi->ps_input_dev->dev, proximity_attr,
 			ARRAY_SIZE(proximity_attr));


Add more metatokens for images.

Add more metatokens for images.

--- src/libstat/stat_process.c
+++ src/libstat/stat_process.c
@@ -98,6 +98,9 @@

 		/* If an image has a linked HTML part, then we push its details to the stat */
 		if (img->html_image) {
+			elt.begin = (gchar *)"image";
+			elt.len = 5;
+			g_array_append_val (ar, elt);
 			elt.begin = (gchar *)&img->html_image->height;
 			elt.len = sizeof (img->html_image->height);
 			g_array_append_val (ar, elt);


iommu/amd: Fix for pasid initialization

iommu/amd: Fix for pasid initialization

The pasid wasn't properly initialized before caling to invalid PPR calback

Signed-off-by: Alexey Skidanov <833d6c2cbb920401adc2e755c4797f7fd439cd94@amd.com>
Signed-off-by: Oded Gabbay <c2fce4493a16d94b58efb315151c29911fc5d347@amd.com>
Signed-off-by: Joerg Roedel <61aff96566804ea1da8a65de5bcc892ce07caceb@suse.de>

--- drivers/iommu/amd_iommu_v2.c
+++ drivers/iommu/amd_iommu_v2.c
@@ -612,6 +612,7 @@
 	fault->state     = pasid_state;
 	fault->tag       = tag;
 	fault->finish    = finish;
+	fault->pasid     = iommu_fault->pasid;
 	fault->flags     = iommu_fault->flags;
 	INIT_WORK(&fault->work, do_fault);


The finite_difference_calculated normal is working for the red colour channel.
Check in now, but will build an example on a full colour texture (or maybe the
alpha channel so will get that working shortly.)
Turn off the debugging flags.

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@5228 3c1deb5b-d424-0410-962d-aba41a686d42

--- source/graphics/material.c
+++ source/graphics/material.c
@@ -361,8 +361,8 @@
 	{
 #if defined (OPENGL_API)
 		/* #define TESTING_PROGRAM_STRINGS */
-#define WRITE_STRING
-#define DEBUG
+		/* #define WRITE_STRING */
+		/* #define DEBUG */
 #if defined (DEBUG)
 		const GLubyte *error_msg;
 #endif /* defined (DEBUG) */


dm cache: do not add migration to completed list before unhooking bio

When completing an overwrite bio, in overwrite_endio(), the associated
migration should not be added to the 'completed_migrations' until the
bio's fields are restored with dm_unhook_bio().

Otherwise, do_worker() can race to process 'completed_migrations' before
dm_unhook_bio() -- so the bio's bi_end_io is incorrect.  This is
unlikely to cause any problems given the current code but should be
fixed on the basis of correctness.

Also, the cache's spinlock only needs to be held when manipulating the
'completed_migrations' list -- other changes don't need protection.

Signed-off-by: Mike Snitzer <85e533f2e78486213c4d69f71462342ec0c62734@redhat.com>
Acked-by: Joe Thornber <61d5fad70554ae22d57a37634e04f12f58acc678@redhat.com>


On Linux, don't forward non-key events. (dm)

--- Programs/keyboard_linux.c
+++ Programs/keyboard_linux.c
@@ -517,8 +517,6 @@
         int press   = event->value == 1;

         if (release || press) handleKeyEvent(kpd->kid, event->code, press);
-      } else {
-        writeInputEvent(event->type, event->code, event->value);
       }

       return sizeof(*event);


Remove now obsolete TODO comment above CRecoveredSigsDb

--- src/llmq/quorums_signing.h
+++ src/llmq/quorums_signing.h
@@ -76,7 +76,6 @@
     }
 };

-// TODO implement caching to speed things up
 class CRecoveredSigsDb
 {
     static const size_t MAX_CACHE_SIZE = 30000;


[PATCH] ibmasm: use after free fix

[PATCH] ibmasm: use after free fix

The kobject_put() can free the memory at *cmd, but cmd->lock points to a
persistent lock that is not freed with cmd.

Signed-off-by: Max Asbock <b66bf2f83a3038862178b8c323de661ecc24c176@us.ibm.com>
Cc: Vernon Mauery <d9dd8b1494fcf3bee086798ba40c441ca8225003@us.ibm.com>
Cc: Srihari Vijayaraghavan <24aa5b29372aa8a7b172e1f11647dd0c5e482e4e@yahoo.com.au>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/misc/ibmasm/ibmasm.h
+++ drivers/misc/ibmasm/ibmasm.h
@@ -101,15 +101,16 @@
 static inline void command_put(struct command *cmd)
 {
 	unsigned long flags;
-
-	spin_lock_irqsave(cmd->lock, flags);
-        kobject_put(&cmd->kobj);
-	spin_unlock_irqrestore(cmd->lock, flags);
+	spinlock_t *lock = cmd->lock;
+
+	spin_lock_irqsave(lock, flags);
+	kobject_put(&cmd->kobj);
+	spin_unlock_irqrestore(lock, flags);
 }

 static inline void command_get(struct command *cmd)
 {
-        kobject_get(&cmd->kobj);
+	kobject_get(&cmd->kobj);
 }


Added license header to minimise.h.  https://tracker.physiomeproject.org/show_bug.cgi?id=1844

--- source/minimise/minimise.h
+++ source/minimise/minimise.h
@@ -1,3 +1,46 @@
+/***************************************************************************//**
+ * FILE : minimise.h
+ *
+ * Optimisation/minimisation routines.
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is cmgui.
+ *
+ * The Initial Developer of the Original Code is
+ * Auckland Uniservices Ltd, Auckland, New Zealand.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+#if !defined (CMISS_MINIMISE_INTERNAL_H)
+#define CMISS_MINIMISE_INTERNAL_H
+
 int gfx_minimise(struct Parse_state *state, void *dummy_to_be_modified,
 	void *command_data_void);
 /*******************************************************************************
@@ -27,3 +70,5 @@
 Creates the package required for minimisation.
 ==============================================================================*/

+#endif /* !defined (CMISS_MINIMISE_INTERNAL_H) */
+


Add a debug log for when the state directories won't be claimed. (dm)

--- Programs/pgmprivs_linux.c
+++ Programs/pgmprivs_linux.c
@@ -1047,6 +1047,8 @@
     if (switchUser(user, &haveHomeDirectory)) {
       umask(umask(0) & ~S_IRWXG);
       claimStateDirectories();
+    } else {
+      logMessage(LOG_DEBUG, "not claiming state directories");
     }

     endpwent();


sgi-xp: nested calls to spin_lock_irqsave()

The code here has a nested spin_lock_irqsave().  It's not needed since
IRQs are already disabled and it causes a problem because it means that
IRQs won't be enabled again at the end.  The second call to
spin_lock_irqsave() will overwrite the value of irq_flags and we can't
restore the proper settings.

Signed-off-by: Dan Carpenter <ff341aa343d564f9e53e9dcb6996be8c04859a66@oracle.com>
Signed-off-by: Robin Holt <fad267d8332d5f62140cfd0120e54d2a812d419e@sgi.com>
Cc: Jack Steiner <9fc09c92f9d4898dd6e5af3e81679b627e939258@sgi.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/misc/sgi-xp/xpc_uv.c
+++ drivers/misc/sgi-xp/xpc_uv.c
@@ -452,9 +452,9 @@

 		if (msg->activate_gru_mq_desc_gpa !=
 		    part_uv->activate_gru_mq_desc_gpa) {
-			spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
+			spin_lock(&part_uv->flags_lock);
 			part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV;
-			spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
+			spin_unlock(&part_uv->flags_lock);
 			part_uv->activate_gru_mq_desc_gpa =
 			    msg->activate_gru_mq_desc_gpa;
 		}


UI elements now connect to a function to set the camera properties

--- qt/flyCapSettingEditor.h
+++ qt/flyCapSettingEditor.h
@@ -7,6 +7,8 @@
 #include "mio/qt/advSliderWidget/advSliderWidget.h"

 class UiPropertySetter : public QWidget{
+  Q_OBJECT
+
   public:
     QHBoxLayout *layout_;
     QLabel *label_;
@@ -14,7 +16,7 @@
     DblAdvSlider *dbl_adv_slider_;
     QCheckBox *chb_auto_, *chb_on_off_, *chb_one_push_;
     QFrame *line_[3];
-    //FlyCapture2::PropertyInfo prop_info_;
+    FlyCapture2::PropertyInfo prop_info_;
     FlyCapture2::Property prop_;

     UiPropertySetter(){
@@ -29,18 +31,33 @@
     ~UiPropertySetter(){
       if(layout_) delete layout_;
       if(label_) delete label_;
-      if(adv_slider_) delete adv_slider_;
-      if(dbl_adv_slider_) delete dbl_adv_slider_;
-      if(chb_auto_) delete chb_auto_;
-      if(chb_on_off_) delete chb_on_off_;
-      if(chb_one_push_) delete chb_one_push_;
+      if(dbl_adv_slider_){
+        disconnect(dbl_adv_slider_, SIGNAL(valueChanged(double)), this, SLOT(SetCameraProp()));
+        delete adv_slider_;
+      }
+      if(adv_slider_){
+        disconnect(adv_slider_, SIGNAL(valueChanged(double)), this, SLOT(SetCameraProp()));
+        delete dbl_adv_slider_;
+      }
+      if(chb_auto_){
+        disconnect(chb_auto_, SIGNAL(clicked()), this, SLOT(SetCameraProp()));
+        delete chb_auto_;
+      }
+      if(chb_on_off_){
+        disconnect(chb_on_off_, SIGNAL(clicked()), this, SLOT(SetCameraProp()));
+        delete chb_on_off_;
+      }
+      if(chb_one_push_){
+        disconnect(chb_one_push_, SIGNAL(clicked()), this, SLOT(SetCameraProp()));
+        delete chb_one_push_;
+      }
     }

     //TODO - each element should get linked to slot which updated prop_ and then calls cam_->setProperty(prop_)
     //TODO - all of these prop_ structs can get saved to an XML file and loaded (prop_info_ is only needed to set
     //       up the UI, which we can get from the camera on startup)
     void Setup(const QString label, const FlyCapture2::PropertyInfo &prop_info, const FlyCapture2::Property &prop){
-      //prop_info_ = prop_;
+      prop_info_ = prop_;
       prop_ = prop;

       layout_ = new QHBoxLayout();
@@ -59,11 +76,13 @@
           dbl_adv_slider_ = new DblAdvSlider(prop_info.absMin, prop_info.absMax, prop.absValue,
                                              3, prop_info.absMin, prop_info.absMax);
           layout_->addWidget(dbl_adv_slider_);
+          connect(dbl_adv_slider_, SIGNAL(valueChanged(double)), this, SLOT(SetCameraProp()));
         }
         else{
           adv_slider_ = new AdvSlider(prop_info.min, prop_info.max, prop.valueA,
                                       prop_info.min, prop_info.max);
           layout_->addWidget(adv_slider_);
+          connect(adv_slider_, SIGNAL(valueChanged(int)), this, SLOT(SetCameraProp()));
         }
       }
       if(prop_info.autoSupported){
@@ -71,22 +90,43 @@
         chb_auto_->setText("auto");
         chb_auto_->setCheckState(prop.autoManualMode ? Qt::Checked : Qt::Unchecked);
         layout_->addWidget(chb_auto_);
+        connect(chb_auto_, SIGNAL(clicked()), this, SLOT(SetCameraProp()));
       }
       if(prop_info.onOffSupported){
         chb_on_off_ = new QCheckBox();
         chb_on_off_->setText("on/off");
         chb_on_off_->setCheckState(prop.onOff ? Qt::Checked : Qt::Unchecked);
         layout_->addWidget(chb_on_off_);
+        connect(chb_on_off_, SIGNAL(clicked()), this, SLOT(SetCameraProp()));
       }
       if(prop_info.onePushSupported){
         chb_one_push_ = new QCheckBox();
         chb_one_push_->setText("prop_info");
         chb_one_push_->setCheckState(prop.onePush ? Qt::Checked : Qt::Unchecked);
         layout_->addWidget(chb_one_push_);
+        connect(chb_one_push_, SIGNAL(clicked()), this, SLOT(SetCameraProp()));
       }

       setLayout(layout_);
       setFixedHeight( sizeHint().height() );
+    }
+
+  private slots:
+    void SetCameraProp(){
+      if(prop_info_.manualSupported){
+        if(prop_info_.absValSupported)
+          prop_.absValue = dbl_adv_slider_.value();
+        else
+          prop_.valueA = adv_silder.value();
+      }
+      if(prop_info.autoSupported)
+        prop_.autoManualMode = (chb_auto_->checkState() == Qt::Checked);
+      if(prop_info.onOffSupported)
+        prop_.onOff = (chb_on_off_->checkState() == Qt::Checked);
+      if(prop_info.onePushSupported)
+        prop_.onePush = (chb_one_push_->checkState() == Qt::Checked);
+
+      PGR_ERR_OK(cam_->SetProperty(&prop), return)
     }
 };

@@ -94,14 +134,14 @@
 class FlyCapControl : public QWidget{
   public:
     FlyCapture2::Camera *cam_;
-    //std::map<FlyCapture2::PropertyType, FlyCapture2::PropertyInfo> prop_info_map_;
-    //std::map<FlyCapture2::PropertyType, FlyCapture2::Property> prop_map_;
     std::map<FlyCapture2::PropertyType, UiPropertySetter*> ui_prop_setter_map_;
     bool absolute_mode_;
     QVBoxLayout *layout_;

     FlyCapControl(){
       layout_ = nullptr;
+      for(auto &elem : ui_prop_setter_map_)
+        delete elem.second;
     }

     ~FlyCapControl(){
@@ -134,6 +174,7 @@
            //FlyCapture2::UNSPECIFIED_PROPERTY_TYPE,
            //FlyCapture2::PROPERTY_TYPE_FORCE_32BITS};

+      //TODO: the units given for some of the strings will be incorrect if absValSupported is false for a particular property
       std::vector<std::string> prop_type_name_vec =
           {"Brightness (%)",
            "Auto Exposure (EV)",
@@ -167,8 +208,6 @@
         if(prop_info.present){
           prop.type = prop_type_vec[i];
           PGR_ERR_OK(cam_->GetProperty(&prop), continue)
-          //prop_info_map_[ prop_type_vec[i] ] = prop_info;
-          //prop_map_[ prop_type_vec[i] ] = prop;
           ui_prop_setter_map_[ prop_type_vec[i] ] = new UiPropertySetter();
           UiPropertySetter *ui_prop_setter = ui_prop_setter_map_[ prop_type_vec[i] ];
           ui_prop_setter->Setup(QString::fromStdString(prop_type_name_vec[i]), prop_info, prop);


Update TripKit.h

Update TripKit.h

--- Project/TripKit/TripKit.h
+++ Project/TripKit/TripKit.h
@@ -18,4 +18,4 @@

 #import "TKTripKit.h"

-#import "TripKitAgenda.h"+#import "TripKitAgenda.h"


mmc: sdhci-s3c: Keep a copy of platform data and use it

The platform data is copied into driver's private data and the copy is
used for all access to the platform data. This simpifies the addition
of device tree support for the sdhci-s3c driver.

Signed-off-by: Thomas Abraham <f8cb4d3099c555ac2fa0712396a78d2cd666d4bd@linaro.org>
Signed-off-by: Kukjin Kim <3fc711f4e08bc570a586748633ff7c76d0e1e253@samsung.com>
Signed-off-by: Chris Ball <6ca7faee6ca9a094b1ee341f11b840a5608a8746@laptop.org>

--- drivers/mmc/host/sdhci-s3c.c
+++ drivers/mmc/host/sdhci-s3c.c
@@ -424,7 +424,7 @@

 static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
 {
-	struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data;
+	struct s3c_sdhci_platdata *pdata;
 	struct sdhci_s3c_drv_data *drv_data;
 	struct device *dev = &pdev->dev;
 	struct sdhci_host *host;
@@ -432,7 +432,7 @@
 	struct resource *res;
 	int ret, irq, ptr, clks;

-	if (!pdata) {
+	if (!pdev->dev.platform_data) {
 		dev_err(dev, "no device data specified\n");
 		return -ENOENT;
 	}
@@ -454,6 +454,13 @@
 		dev_err(dev, "sdhci_alloc_host() failed\n");
 		return PTR_ERR(host);
 	}
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata) {
+		ret = -ENOMEM;
+		goto err_io_clk;
+	}
+	memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata));

 	drv_data = sdhci_s3c_get_driver_data(pdev);
 	sc = sdhci_priv(host);


Input handler fix

Input handler fix

--- Pukli/src/Input_handler.h
+++ Pukli/src/Input_handler.h
@@ -6,6 +6,8 @@
 #include <SDL.h>
 #include "Vec2D.h"
 #include "utils.h"
+
+#define SDL_BUTTONS_SIZE 4

 const enum MOUSE_BUTTONS {LEFT=1, MIDDLE=2, RIGHT=3};
 const Sint16 joystick_deadzone = 5000;
@@ -40,7 +42,7 @@

 private:
 	// Singleton
-	Input_handler() :m_mouse_button_states(3, false), m_mouse_position(new Vec2D(0,0)) {}
+	Input_handler() :m_mouse_button_states(SDL_BUTTONS_SIZE, false), m_mouse_position(new Vec2D(0, 0)) {}
 	static Input_handler* s_instance;

 	// Keyboard data & functions


mtd: nand: split BB marker options decoding into its own function

When detecting NAND parameters, the code gets a little ugly so that the
logic is obscured. Try to remedy that by moving code to separate functions
that have well-defined purposes.

This patch splits the bad block marker options detection into its own function,
away from the other parameters (e.g., chip size, page size, etc.).

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

--- drivers/mtd/nand/nand_base.c
+++ drivers/mtd/nand/nand_base.c
@@ -2903,6 +2903,43 @@

 	pr_info("ONFI flash detected\n");
 	return 1;
+}
+
+/*
+ * Set the bad block marker/indicator (BBM/BBI) patterns according to some
+ * heuristic patterns using various detected parameters (e.g., manufacturer,
+ * page size, cell-type information).
+ */
+static void nand_decode_bbm_options(struct mtd_info *mtd,
+				    struct nand_chip *chip, u8 id_data[8])
+{
+	int maf_id = id_data[0];
+
+	/* Set the bad block position */
+	if (mtd->writesize > 512 || (chip->options & NAND_BUSWIDTH_16))
+		chip->badblockpos = NAND_LARGE_BADBLOCK_POS;
+	else
+		chip->badblockpos = NAND_SMALL_BADBLOCK_POS;
+
+	/*
+	 * Bad block marker is stored in the last page of each block on Samsung
+	 * and Hynix MLC devices; stored in first two pages of each block on
+	 * Micron devices with 2KiB pages and on SLC Samsung, Hynix, Toshiba,
+	 * AMD/Spansion, and Macronix.  All others scan only the first page.
+	 */
+	if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
+			(maf_id == NAND_MFR_SAMSUNG ||
+			 maf_id == NAND_MFR_HYNIX))
+		chip->bbt_options |= NAND_BBT_SCANLASTPAGE;
+	else if ((!(chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
+				(maf_id == NAND_MFR_SAMSUNG ||
+				 maf_id == NAND_MFR_HYNIX ||
+				 maf_id == NAND_MFR_TOSHIBA ||
+				 maf_id == NAND_MFR_AMD ||
+				 maf_id == NAND_MFR_MACRONIX)) ||
+			(mtd->writesize == 2048 &&
+			 maf_id == NAND_MFR_MICRON))
+		chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;
 }

 /*
@@ -3087,6 +3124,8 @@
 		return ERR_PTR(-EINVAL);
 	}

+	nand_decode_bbm_options(mtd, chip, id_data);
+
 	/* Calculate the address shift from the page size */
 	chip->page_shift = ffs(mtd->writesize) - 1;
 	/* Convert chipsize to number of pages per chip -1 */
@@ -3102,33 +3141,6 @@
 	}

 	chip->badblockbits = 8;
-
-	/* Set the bad block position */
-	if (mtd->writesize > 512 || (busw & NAND_BUSWIDTH_16))
-		chip->badblockpos = NAND_LARGE_BADBLOCK_POS;
-	else
-		chip->badblockpos = NAND_SMALL_BADBLOCK_POS;
-
-	/*
-	 * Bad block marker is stored in the last page of each block
-	 * on Samsung and Hynix MLC devices; stored in first two pages
-	 * of each block on Micron devices with 2KiB pages and on
-	 * SLC Samsung, Hynix, Toshiba, AMD/Spansion, and Macronix.
-	 * All others scan only the first page.
-	 */
-	if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
-			(*maf_id == NAND_MFR_SAMSUNG ||
-			 *maf_id == NAND_MFR_HYNIX))
-		chip->bbt_options |= NAND_BBT_SCANLASTPAGE;
-	else if ((!(chip->cellinfo & NAND_CI_CELLTYPE_MSK) &&
-				(*maf_id == NAND_MFR_SAMSUNG ||
-				 *maf_id == NAND_MFR_HYNIX ||
-				 *maf_id == NAND_MFR_TOSHIBA ||
-				 *maf_id == NAND_MFR_AMD ||
-				 *maf_id == NAND_MFR_MACRONIX)) ||
-			(mtd->writesize == 2048 &&
-			 *maf_id == NAND_MFR_MICRON))
-		chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;

 	/* Check for AND chips with 4 page planes */
 	if (chip->options & NAND_4PAGE_ARRAY)


mtd: nand: move SCANLASTPAGE handling to the correct code block

As nand_default_block_markbad() is becoming more complex, it helps to
have code appear only in its relevant codepath(s). Here, the calculation
of `ofs' based on NAND_BBT_SCANLASTPAGE is only useful on paths where we
write bad block markers to OOB. We move the condition/calculation closer
to the `write' operation and update the comment to more correctly
describe the operation.

The variable `wr_ofs' is also used to help isolate our calculation of
the "write" offset from the usage of `ofs' to represent the eraseblock
offset. This will become useful when we reorder operations in the next
patch.

This patch should make no functional change.

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

--- drivers/mtd/nand/nand_base.c
+++ drivers/mtd/nand/nand_base.c
@@ -411,9 +411,6 @@
 		nand_erase_nand(mtd, &einfo, 0);
 	}

-	if (chip->bbt_options & NAND_BBT_SCANLASTPAGE)
-		ofs += mtd->erasesize - mtd->writesize;
-
 	/* Get block number */
 	block = (int)(ofs >> chip->bbt_erase_shift);
 	if (chip->bbt)
@@ -424,11 +421,12 @@
 		ret = nand_update_bbt(mtd, ofs);
 	else {
 		struct mtd_oob_ops ops;
+		loff_t wr_ofs = ofs;

 		nand_get_device(chip, mtd, FL_WRITING);

 		/*
-		 * Write to first two pages if necessary. If we write to more
+		 * Write to first/last page(s) if necessary. If we write to more
 		 * than one location, the first error encountered quits the
 		 * procedure.
 		 */
@@ -442,11 +440,14 @@
 			ops.len = ops.ooblen = 1;
 		}
 		ops.mode = MTD_OPS_PLACE_OOB;
+
+		if (chip->bbt_options & NAND_BBT_SCANLASTPAGE)
+			wr_ofs += mtd->erasesize - mtd->writesize;
 		do {
-			ret = nand_do_write_oob(mtd, ofs, &ops);
+			ret = nand_do_write_oob(mtd, wr_ofs, &ops);

 			i++;
-			ofs += mtd->writesize;
+			wr_ofs += mtd->writesize;
 		} while (!ret && (chip->bbt_options & NAND_BBT_SCAN2NDPAGE) &&
 				i < 2);


Fix source code

Fix source code

--- src/kbdlogd.c
+++ src/kbdlogd.c
@@ -40,8 +40,7 @@
 int update_flag = 1;
 int update_time;

-void main (int argc, char **argv)
-{
+void main (int argc, char **argv) {
     int c, fd;
     int option_index = 0;

@@ -164,11 +163,11 @@
             }

             fd = open(KBDL_NULL, O_RDWR, 0);
-            if(fd != -1) {
+            if (fd != -1) {
                 dup2(fd, STDIN_FILENO);
                 dup2(fd, STDOUT_FILENO);
                 dup2(fd, STDERR_FILENO);
-                if(fd > 2) close(fd);
+                if (fd > 2) close(fd);
             }
     }

@@ -187,8 +186,7 @@
     kbdlogd_s();
 }

-void end_sig(int signum)
-{
+void end_sig(int signum) {
     fclose(lfd);
     puts_syslog(KBDL_SYSL_E);

@@ -198,8 +196,7 @@
     exit(EXIT_SUCCESS);
 }

-void kbdlogd_s()
-{
+void kbdlogd_s() {
     int fd, size, keyid, x = -1, c = 0;
     char timebuf[100];
     char *keybuf[255];
@@ -271,8 +268,7 @@
     }
 }

-void *update()
-{
+void *update() {
     while (true) {
         users();
         if (!update_flag) sleep(update_time);
@@ -282,8 +278,7 @@
     pthread_exit(NULL);
 }

-void users(void)
-{
+void users(void) {
     int fd, rd;
     struct utmp ut;
     pid_t pid;
@@ -312,7 +307,7 @@
             exit(EXIT_FAILURE);
         }

-        if(rd == 0) break;
+        if (rd == 0) break;

         if (ut.ut_type == USER_PROCESS) {
             if (debug_flag == 0) printf("'%s' at '%s'\n", ut.ut_name, ut.ut_id);
@@ -329,23 +324,20 @@
     fflush(lfd);
 }

-void puts_debug(char *str, int type)
-{
+void puts_debug(char *str, int type) {
     if (debug_flag == 0) {
         if (type == 0) puts(str);
         else printf("%s", str);
     }
 }

-void puts_syslog(char *str)
-{
+void puts_syslog(char *str) {
     openlog(KBDL_NAME, LOG_PID, LOG_DAEMON);
     syslog(LOG_NOTICE, "%s", str);
     closelog();
 }

-void usage(void)
-{
+void usage(void) {
     puts("usage: kbdlogd [OPTIONS]...\n"
         "Capure keyboard stream data from /dev/input/*\n\n"
         "Avaiable options.\n"


omit unnecessary test, because NGX_ERROR == -1, but r->headers_out.last_modified_time != -1 at this point

--- src/http/modules/ngx_http_not_modified_filter_module.c
+++ src/http/modules/ngx_http_not_modified_filter_module.c
@@ -70,7 +70,7 @@
      * I think that the equality of the dates is correcter
      */

-    if (ims != NGX_ERROR && ims == r->headers_out.last_modified_time) {
+    if (ims == r->headers_out.last_modified_time) {
         r->headers_out.status = NGX_HTTP_NOT_MODIFIED;
         r->headers_out.content_type.len = 0;
         ngx_http_clear_content_length(r);


ENH: Removed unnecessary dependency on the header of the SymmetricSecondRankTensor.

--- Code/Common/itkNumericTraitsDiffusionTensor3DPixel.h
+++ Code/Common/itkNumericTraitsDiffusionTensor3DPixel.h
@@ -18,7 +18,6 @@
 #define __itkNumericTraitsDiffusionTensor3DPixel_h

 #include "itkNumericTraitsFixedArrayPixel.h"
-#include "itkSymmetricSecondRankTensor.h"
 #include "itkDiffusionTensor3D.h"

 // This file is meant to define numeric traits for tensor pixels types in itk


update

update

--- backend/src/controllers/contrib/root_controller.c
+++ backend/src/controllers/contrib/root_controller.c
@@ -28,7 +28,7 @@
     }

     char CliStm[4096];
-    kore_log (LOG_INFO, "%s", Data);
+
     struct FuncResult Ret = GetJsonString (Data, "Statement", CliStm);
     kore_log (LOG_INFO, "%s", CliStm);


* Fixed typo in android mode

* Fixed typo in android mode

--- src/kv/iwal.c
+++ src/kv/iwal.c
@@ -868,7 +868,7 @@
     = opts->wal.checkpoint_buffer_sz > 0 ?
       opts->wal.checkpoint_buffer_sz :
 #ifdef __ANDROID__
-      64ULL * 1024 * 1024 // 64M
+      64ULL * 1024 * 1024; // 64M
 #else
       1024ULL * 1024 * 1024; // 1G
 #endif


adding bounding boxes back into the mix

adding bounding boxes back into the mix

--- data/camera_vm/components/camera_vm/src/camera_vm.c
+++ data/camera_vm/components/camera_vm/src/camera_vm.c
@@ -52,21 +52,33 @@

 static void rec_packet(libvchan_t * con) {
     char done = 1;
-    float angles[2];
-		struct camera_angles ca;
+    int data[4];
+	struct camera_angles ca;

     libvchan_wait(con);
-    int readSize = libvchan_recv(con, angles, 2*sizeof(float));
-    assert(readSize == 2*sizeof(float));
-    DVM("received an angle packet\n");
+    int readSize = libvchan_recv(con, data, 4*sizeof(int));
+    assert(readSize == 4*sizeof(int));
+    DVM("received bounding box packet\n");

-		ca.angle_x = angles[0];
-		ca.angle_y = angles[1];
+    //here are your corners Lee!
+    int l = data[0];
+    int r = data[1];
+    int t = data[2];
+    int b = data[3];
+
+    int xmid = ((r + l) / 2) - 160;
+    int ymid = ((b + t) / 2) - 100;
+
+    ymid = -1.0*ymid; //sign change (based on how the camera is oriented)
+
+    //here are your angles Lee!
+    ca.angle_x = ((float) xmid)*(0.00410666);
+    ca.angle_y = ((float) ymid)*(0.00410666);

     if (camera_vm_Output_from_vm_0_write_camera_angles(&ca)) {
-	DVM("wrote angles\n");
+	DVM("wrote bounding box\n");
     } else {
-	DVM("failed to write angles\n");
+	DVM("failed to write bouding box\n");
     }

     DVM("camera_vm: sending ack\n");