On 11/19/2010 6:06 AM, R, Durgadoss wrote:
+static int get_current_value(int index, int value)
+{
+ int pos = 0;
+
+ /* Find the index of 'value' in the thresholds array */
+ while (value> curr_thresholds[index][pos++])
+ ;
+
+ if (value != curr_thresholds[index][--pos])
+ --pos;
I would feel much better if index, and more importantly, "pos" will be
bounds checked here.
both that it doesn't go over the bounds... but also that the "--pos"
does not go negative..
+ struct device_attribute *attr, char *buf)
+{
+ int ret, indx;
+ uint8_t data;
+ struct sensor_device_attribute_2 *s_attr =
+ to_sensor_dev_attr_2(attr);
+
+ WARN_ON(s_attr->nr != 0&& s_attr->nr != 1);
hmm WARN_ON() on user input ? that's not generally nice..
+static ssize_t show_acc_time(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct cmd_info *cinfo = dev_get_drvdata(dev);
+ long time_gap;
+
+ if (cinfo->acc_time == 0)
+ return sprintf(buf, "0\n");
+
+ /* Calculate the time gap in jiffies */
+ time_gap = jiffies - cinfo->acc_time;
hmmm do we really need to use jiffies ?
I'd much rather just avoid it entirely.
+
+ /* Convert to milli secs and print */
+ return sprintf(buf, "%u\n", jiffies_to_msecs(time_gap));
+}
+
+static irqreturn_t cmd_handle_intrpt(int irq, void *dev_data)
+{
+ int ret;
+ uint8_t data;
+ struct cmd_info *cinfo = (struct cmd_info *)dev_data;
+
+ if (!cinfo)
+ return IRQ_HANDLED;
wrong answer since clearly you did not handle the interrupt ;)+
+static int enable_interrupt(struct cmd_info *cinfo)
+{
+ int ret;
+
+ /* Workaround till an sfi table entry comes */
+ cinfo->irq = gpio_to_irq(30);
please put in the right pieces, and don't do workarounds here...
if any, they all need to be in mrst.c, and with a comment as to which
version
of the firmware has the fix (so that we can delete them once we rev the
minimum firmware version)
+static struct attribute *mid_cmd_attrs[] = {
+&sensor_dev_attr_bcu_status.dev_attr.attr,
+&sensor_dev_attr_action_mask.dev_attr.attr,
+&sensor_dev_attr_current_warning.dev_attr.attr,
+&sensor_dev_attr_current_shutdown.dev_attr.attr,
+&sensor_dev_attr_timer_warning.dev_attr.attr,
+&sensor_dev_attr_timer_hw_action.dev_attr.attr,
+&sensor_dev_attr_timer_shutdown.dev_attr.attr,
+&sensor_dev_attr_warning_count.dev_attr.attr,
+&sensor_dev_attr_accumulation_time.dev_attr.attr,
+&sensor_dev_attr_action_status.dev_attr.attr,
this is an aweful high number of new userspace interfaces....
_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel