Re: [RFC PATCH 36/41] staging: dwc2: Make dwc2_set_uninitialized more specific

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06.04.2013 1:27, Matthijs Kooijman wrote:

Before, it was a function that would set all members of a given struct
containing only int members to -1. Now, it is renamed to
dwc_set_all_params and it works only on the dwc2_core_params struct.
This makes sure that all of the slightly dubious casting and assumptions
happen inside the function instead of by the caller.

Signed-off-by: Matthijs Kooijman <matthijs@xxxxxxxx>
[...]

diff --git a/drivers/staging/dwc2/core.h b/drivers/staging/dwc2/core.h
index e9acbf1..a60de0f 100644
--- a/drivers/staging/dwc2/core.h
+++ b/drivers/staging/dwc2/core.h
@@ -193,6 +193,8 @@ enum dwc2_lx_state {
   * default described above.
   */
  struct dwc2_core_params {
+	/* Don't add any non-int members here, this will break
+	 * dwc2_set_all_params! */

   The preferred style of multi-line comments is like your comment below.

diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c
index 409e5e5..747e787 100644
--- a/drivers/staging/dwc2/hcd.c
+++ b/drivers/staging/dwc2/hcd.c
@@ -2673,8 +2673,15 @@ static void dwc2_hcd_release(struct dwc2_hsotg *hsotg)
  	dwc2_hcd_free(hsotg);
  }

-static void dwc2_set_uninitialized(int *p, int size)
+/*
+ * Sets all parameters to the given value.
+ *
+ * Assumes that the dwc2_core_params struct contains only integers.
+ */
+void dwc2_set_all_params(struct dwc2_core_params *params, int value)
[...]

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux