All of lore.kernel.org
 help / color / mirror / Atom feed
From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: max1619
Date: Thu, 19 May 2005 06:25:00 +0000	[thread overview]
Message-ID: <20040526214054.6f2bcb35.khali@linux-fr.org> (raw)
In-Reply-To: <200405211303.18083.fishor@gmx.net>

> here is two patches for linux kernel and for CVS

I've applied the CVS patch. I changed "temp2_hyst" to "temp2_crit_hyst"
though. In 2.6, hysteresis files have to reflect what they are an
hysteresis for.

About the linux kernel patch now:

diff -ruN linux-2.6.6-mm5/drivers/i2c/chips/Kconfig linux-2.6.6-mm5-max1619/drivers/i2c/chips/Kconfig
--- linux-2.6.6-mm5/drivers/i2c/chips/Kconfig	2004-05-25 08:51:38.000000000 +0200
+++ linux-2.6.6-mm5-max1619/drivers/i2c/chips/Kconfig	2004-05-25 09:01:53.000000000 +0200
+config SENSORS_MAX1619
+	tristate "Maxim MAX1619 sensor chip"
+	depends on I2C

depends on I2C && EXPERIMENTAL

diff -ruN linux-2.6.6-mm5/drivers/i2c/chips/max1619.c linux-2.6.6-mm5-max1619/drivers/i2c/chips/max1619.c
--- linux-2.6.6-mm5/drivers/i2c/chips/max1619.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.6-mm5-max1619/drivers/i2c/chips/max1619.c	2004-05-25 09:19:28.000000000 +0200
+ * max1619.c - Part of lm_sensors, Linux kernel modules for hardware
+ *          monitoring
+ * Copyright (C) 2003-2004 Alexey Fisher <fishor@mail.ru>
+ *                              Jean Delvare <khali@linux-fr.org>

Please align "monitoring" on "Part" and "Jean" on "Alexey", using spaces.

+ * Based on the lm90 driver. The MAX1619 is a sensor chip made by Maxim .
+ * It reports up to two temperatures (its own plus up to
+ * one external one) . Complete datasheet can be
+ * obtained from Maxim's website at:
+ *   http://pdfserv.maxim-ic.com/en/ds/MAX1619.pdf

No white spaces before dots please.

+#define show_temp(value, converter) \
+static ssize_t show_##value(struct device *dev, char *buf) \
+{ \
+	struct max1619_data *data = max1619_update_device(dev); \
+	return sprintf(buf, "%d\n", converter(data->value)); \
+}
+show_temp(temp_input1, TEMP_FROM_REG);
+show_temp(temp_input2, TEMP_FROM_REG);
+show_temp(temp_low2, TEMP_FROM_REG);
+show_temp(temp_high2, TEMP_FROM_REG);
+show_temp(temp_crit2, TEMP_FROM_REG);
+show_temp(temp_hyst2, TEMP_FROM_REG);

TEMP_FROM_REG doesn't have to be passed by parameter, since it's always
the same.

+static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2,
+	set_temp_crit2);
+static DEVICE_ATTR(temp2_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2,
+	set_temp_hyst2);

File has to be named temp2_crit_hyst instead of temp2_hyst.


+static int max1619_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	struct i2c_client *new_client;
+	struct max1619_data *data;
+	int err = 0;
+        const char *name = "";	

Broken indentation, you have 8 spaces instead of one tabulation.

+	/* The common I2C client data is placed right before the
+	   LM90-specific data. */

You forgot to update that comment.


+	if (kind <= 0) { /* identification */
+	
+		man_id = i2c_smbus_read_byte_data(new_client,
+			 MAX1619_REG_R_MAN_ID);
+		chip_id = i2c_smbus_read_byte_data(new_client,
+			  MAX1619_REG_R_CHIP_ID);
+		
+		if ((man_id = 0x4D) && (chip_id = 0x04)) 
+			{  
+				kind = max1619;
+			}
+		
+		}

Discard these extra empty lines. Move the opening { at the end of the
"if..." line.

+	if (kind = max1619) 
+	{
+		name = "max1619";
+	}

Same here, opening curly brace is misplaced.

+	device_create_file(&new_client->dev, &dev_attr_temp2_crit);
+	device_create_file(&new_client->dev, &dev_attr_temp2_hyst);

Rename here too.

+MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru>" \
+		"Jean Delvare <khali@linux-fr.org>");

No \ here. You can just split the string over lines and the compiler
will join them for you:

MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and "
	      "Jean Delvare <khali@linux-fr.org>");

In any case, *you* are the author, I don't deserve to have my name here
;)

Rest is just fine. I told you you could do it! Very impressive :)

Once you have fixed everything, and have tested the new version with
lm_sensors CVS, you should be able to submit your new driver to Greg KH
for inclusion into the main 2.6 tree. Briefly explain what the driver is
for and how you wrote it (including the fact that I reviewed it). Don't
forget to CC: the lm_sensors mailing list. Note that you have to send
the patch *inline* (as opposed to in attachement) when sending patches
to Greg. Make sure that your e-mail client won't break it (various
e-mail clients would break long lines or replace tabs with spaces...).

Thanks, and congratulations again :)

-- 
Jean Delvare
http://khali.linux-fr.org/

  parent reply	other threads:[~2005-05-19  6:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-19  6:24 max1619 Alexey Fisher
2005-05-19  6:24 ` max1619 Jean Delvare
2005-05-19  6:24 ` max1619 Alexey Fisher
2005-05-19  6:24 ` max1619 Jean Delvare
2005-05-19  6:24 ` max1619 Alexey Fisher
2005-05-19  6:24 ` max1619 Alexey Fisher
2005-05-19  6:24 ` max1619 Alexey Fisher
2005-05-19  6:24 ` max1619 Alexey Fisher
2005-05-19  6:24 ` max1619 Alexey Fisher
2005-05-19  6:24 ` max1619 Jean Delvare
2005-05-19  6:24 ` max1619 Jean Delvare
2005-05-19  6:24 ` max1619 Jean Delvare
2005-05-19  6:24 ` max1619 Alexey Fisher
2005-05-19  6:24 ` max1619 Jean Delvare
2005-05-19  6:25 ` max1619 Jean Delvare
2005-05-19  6:25 ` max1619 Alexey Fisher
2005-05-19  6:25 ` Jean Delvare [this message]
2005-05-19  6:25 ` max1619 Jean Delvare
2005-05-19  6:25 ` max1619 Alexey Fisher
2005-05-19  6:25 ` max1619 Jean Delvare
2005-05-19  6:25 ` max1619 Alexey Fisher
2005-05-19  6:25 ` max1619 Alexey Fisher
2005-05-19  6:25 ` max1619 Greg KH
2005-05-19  6:25 ` max1619 Alexey Fisher
2005-05-19  6:25 ` max1619 Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040526214054.6f2bcb35.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.