All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@linux.intel.com>
To: Denis Turischev <denis@compulab.co.il>
Cc: LKML <linux-kernel@vger.kernel.org>, linux-i2c@vger.kernel.org
Subject: Re: [PATCH v4 2/3] i2c: convert i2c-isch to platform_device
Date: Tue, 2 Mar 2010 11:06:44 +0100	[thread overview]
Message-ID: <20100302100643.GA3195@sortiz.org> (raw)
In-Reply-To: <4B8BF28B.1060701@compulab.co.il>

Hi Denis,

On Mon, Mar 01, 2010 at 06:59:55PM +0200, Denis Turischev wrote:
> v2: there is no acpi_check_region, it will be implemented in mfd-core
> v3: patch refreshed against the latest Linus tree
> v4: refreshed again
Patch applied, many thanks.

Cheers,
Samuel.


> Signed-off-by: Denis Turischev <denis@compulab.co.il>
> 
> ---
>  drivers/i2c/busses/Kconfig    |    2 +-
>  drivers/i2c/busses/i2c-isch.c |   68 ++++++++++++++++------------------------
>  2 files changed, 28 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index 5f318ce..d15b6d3 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -104,7 +104,7 @@ config I2C_I801
> 
>  config I2C_ISCH
>  	tristate "Intel SCH SMBus 1.0"
> -	depends on PCI
> +	select LPC_SCH
>  	help
>  	  Say Y here if you want to use SMBus controller on the Intel SCH
>  	  based systems.
> diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
> index dba6eb0..ddc258e 100644
> --- a/drivers/i2c/busses/i2c-isch.c
> +++ b/drivers/i2c/busses/i2c-isch.c
> @@ -27,7 +27,7 @@
>  */
> 
>  #include <linux/module.h>
> -#include <linux/pci.h>
> +#include <linux/platform_device.h>
>  #include <linux/kernel.h>
>  #include <linux/delay.h>
>  #include <linux/stddef.h>
> @@ -46,12 +46,6 @@
>  #define SMBHSTDAT1	(7 + sch_smba)
>  #define SMBBLKDAT	(0x20 + sch_smba)
> 
> -/* count for request_region */
> -#define SMBIOSIZE	64
> -
> -/* PCI Address Constants */
> -#define SMBBA_SCH	0x40
> -
>  /* Other settings */
>  #define MAX_TIMEOUT	500
> 
> @@ -63,7 +57,6 @@
>  #define SCH_BLOCK_DATA		0x05
> 
>  static unsigned short sch_smba;
> -static struct pci_driver sch_driver;
>  static struct i2c_adapter sch_adapter;
> 
>  /*
> @@ -256,37 +249,23 @@ static struct i2c_adapter sch_adapter = {
>  	.algo		= &smbus_algorithm,
>  };
> 
> -static struct pci_device_id sch_ids[] = {
> -	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_LPC) },
> -	{ 0, }
> -};
> -
> -MODULE_DEVICE_TABLE(pci, sch_ids);
> -
> -static int __devinit sch_probe(struct pci_dev *dev,
> -				const struct pci_device_id *id)
> +static int __devinit smbus_sch_probe(struct platform_device *dev)
>  {
> +	struct resource *res;
>  	int retval;
> -	unsigned int smba;
> 
> -	pci_read_config_dword(dev, SMBBA_SCH, &smba);
> -	if (!(smba & (1 << 31))) {
> -		dev_err(&dev->dev, "SMBus I/O space disabled!\n");
> -		return -ENODEV;
> -	}
> +	res = platform_get_resource(dev, IORESOURCE_IO, 0);
> +	if (!res)
> +		return -EBUSY;
> 
> -	sch_smba = (unsigned short)smba;
> -	if (sch_smba == 0) {
> -		dev_err(&dev->dev, "SMBus base address uninitialized!\n");
> -		return -ENODEV;
> -	}
> -	if (acpi_check_region(sch_smba, SMBIOSIZE, sch_driver.name))
> -		return -ENODEV;
> -	if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) {
> +	if (!request_region(res->start, resource_size(res), dev->name)) {
>  		dev_err(&dev->dev, "SMBus region 0x%x already in use!\n",
>  			sch_smba);
>  		return -EBUSY;
>  	}
> +
> +	sch_smba = res->start;
> +
>  	dev_dbg(&dev->dev, "SMBA = 0x%X\n", sch_smba);
> 
>  	/* set up the sysfs linkage to our parent device */
> @@ -298,37 +277,43 @@ static int __devinit sch_probe(struct pci_dev *dev,
>  	retval = i2c_add_adapter(&sch_adapter);
>  	if (retval) {
>  		dev_err(&dev->dev, "Couldn't register adapter!\n");
> -		release_region(sch_smba, SMBIOSIZE);
> +		release_region(res->start, resource_size(res));
>  		sch_smba = 0;
>  	}
> 
>  	return retval;
>  }
> 
> -static void __devexit sch_remove(struct pci_dev *dev)
> +static int __devexit smbus_sch_remove(struct platform_device *pdev)
>  {
> +	struct resource *res;
>  	if (sch_smba) {
>  		i2c_del_adapter(&sch_adapter);
> -		release_region(sch_smba, SMBIOSIZE);
> +		res = platform_get_resource(pdev, IORESOURCE_IO, 0);
> +		release_region(res->start, resource_size(res));
>  		sch_smba = 0;
>  	}
> +
> +	return 0;
>  }
> 
> -static struct pci_driver sch_driver = {
> -	.name		= "isch_smbus",
> -	.id_table	= sch_ids,
> -	.probe		= sch_probe,
> -	.remove		= __devexit_p(sch_remove),
> +static struct platform_driver smbus_sch_driver = {
> +	.driver = {
> +		.name = "isch_smbus",
> +		.owner = THIS_MODULE,
> +	},
> +	.probe		= smbus_sch_probe,
> +	.remove		= __devexit_p(smbus_sch_remove),
>  };
> 
>  static int __init i2c_sch_init(void)
>  {
> -	return pci_register_driver(&sch_driver);
> +	return platform_driver_register(&smbus_sch_driver);
>  }
> 
>  static void __exit i2c_sch_exit(void)
>  {
> -	pci_unregister_driver(&sch_driver);
> +	platform_driver_unregister(&smbus_sch_driver);
>  }
> 
>  MODULE_AUTHOR("Jacob Pan <jacob.jun.pan@intel.com>");
> @@ -337,3 +322,4 @@ MODULE_LICENSE("GPL");
> 
>  module_init(i2c_sch_init);
>  module_exit(i2c_sch_exit);
> +MODULE_ALIAS("platform:isch_smbus");
> -- 
> 1.6.3.3

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

WARNING: multiple messages have this Message-ID (diff)
From: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Denis Turischev <denis-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
Cc: LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v4 2/3] i2c: convert i2c-isch to platform_device
Date: Tue, 2 Mar 2010 11:06:44 +0100	[thread overview]
Message-ID: <20100302100643.GA3195@sortiz.org> (raw)
In-Reply-To: <4B8BF28B.1060701-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>

Hi Denis,

On Mon, Mar 01, 2010 at 06:59:55PM +0200, Denis Turischev wrote:
> v2: there is no acpi_check_region, it will be implemented in mfd-core
> v3: patch refreshed against the latest Linus tree
> v4: refreshed again
Patch applied, many thanks.

Cheers,
Samuel.


> Signed-off-by: Denis Turischev <denis-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
> 
> ---
>  drivers/i2c/busses/Kconfig    |    2 +-
>  drivers/i2c/busses/i2c-isch.c |   68 ++++++++++++++++------------------------
>  2 files changed, 28 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index 5f318ce..d15b6d3 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -104,7 +104,7 @@ config I2C_I801
> 
>  config I2C_ISCH
>  	tristate "Intel SCH SMBus 1.0"
> -	depends on PCI
> +	select LPC_SCH
>  	help
>  	  Say Y here if you want to use SMBus controller on the Intel SCH
>  	  based systems.
> diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
> index dba6eb0..ddc258e 100644
> --- a/drivers/i2c/busses/i2c-isch.c
> +++ b/drivers/i2c/busses/i2c-isch.c
> @@ -27,7 +27,7 @@
>  */
> 
>  #include <linux/module.h>
> -#include <linux/pci.h>
> +#include <linux/platform_device.h>
>  #include <linux/kernel.h>
>  #include <linux/delay.h>
>  #include <linux/stddef.h>
> @@ -46,12 +46,6 @@
>  #define SMBHSTDAT1	(7 + sch_smba)
>  #define SMBBLKDAT	(0x20 + sch_smba)
> 
> -/* count for request_region */
> -#define SMBIOSIZE	64
> -
> -/* PCI Address Constants */
> -#define SMBBA_SCH	0x40
> -
>  /* Other settings */
>  #define MAX_TIMEOUT	500
> 
> @@ -63,7 +57,6 @@
>  #define SCH_BLOCK_DATA		0x05
> 
>  static unsigned short sch_smba;
> -static struct pci_driver sch_driver;
>  static struct i2c_adapter sch_adapter;
> 
>  /*
> @@ -256,37 +249,23 @@ static struct i2c_adapter sch_adapter = {
>  	.algo		= &smbus_algorithm,
>  };
> 
> -static struct pci_device_id sch_ids[] = {
> -	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SCH_LPC) },
> -	{ 0, }
> -};
> -
> -MODULE_DEVICE_TABLE(pci, sch_ids);
> -
> -static int __devinit sch_probe(struct pci_dev *dev,
> -				const struct pci_device_id *id)
> +static int __devinit smbus_sch_probe(struct platform_device *dev)
>  {
> +	struct resource *res;
>  	int retval;
> -	unsigned int smba;
> 
> -	pci_read_config_dword(dev, SMBBA_SCH, &smba);
> -	if (!(smba & (1 << 31))) {
> -		dev_err(&dev->dev, "SMBus I/O space disabled!\n");
> -		return -ENODEV;
> -	}
> +	res = platform_get_resource(dev, IORESOURCE_IO, 0);
> +	if (!res)
> +		return -EBUSY;
> 
> -	sch_smba = (unsigned short)smba;
> -	if (sch_smba == 0) {
> -		dev_err(&dev->dev, "SMBus base address uninitialized!\n");
> -		return -ENODEV;
> -	}
> -	if (acpi_check_region(sch_smba, SMBIOSIZE, sch_driver.name))
> -		return -ENODEV;
> -	if (!request_region(sch_smba, SMBIOSIZE, sch_driver.name)) {
> +	if (!request_region(res->start, resource_size(res), dev->name)) {
>  		dev_err(&dev->dev, "SMBus region 0x%x already in use!\n",
>  			sch_smba);
>  		return -EBUSY;
>  	}
> +
> +	sch_smba = res->start;
> +
>  	dev_dbg(&dev->dev, "SMBA = 0x%X\n", sch_smba);
> 
>  	/* set up the sysfs linkage to our parent device */
> @@ -298,37 +277,43 @@ static int __devinit sch_probe(struct pci_dev *dev,
>  	retval = i2c_add_adapter(&sch_adapter);
>  	if (retval) {
>  		dev_err(&dev->dev, "Couldn't register adapter!\n");
> -		release_region(sch_smba, SMBIOSIZE);
> +		release_region(res->start, resource_size(res));
>  		sch_smba = 0;
>  	}
> 
>  	return retval;
>  }
> 
> -static void __devexit sch_remove(struct pci_dev *dev)
> +static int __devexit smbus_sch_remove(struct platform_device *pdev)
>  {
> +	struct resource *res;
>  	if (sch_smba) {
>  		i2c_del_adapter(&sch_adapter);
> -		release_region(sch_smba, SMBIOSIZE);
> +		res = platform_get_resource(pdev, IORESOURCE_IO, 0);
> +		release_region(res->start, resource_size(res));
>  		sch_smba = 0;
>  	}
> +
> +	return 0;
>  }
> 
> -static struct pci_driver sch_driver = {
> -	.name		= "isch_smbus",
> -	.id_table	= sch_ids,
> -	.probe		= sch_probe,
> -	.remove		= __devexit_p(sch_remove),
> +static struct platform_driver smbus_sch_driver = {
> +	.driver = {
> +		.name = "isch_smbus",
> +		.owner = THIS_MODULE,
> +	},
> +	.probe		= smbus_sch_probe,
> +	.remove		= __devexit_p(smbus_sch_remove),
>  };
> 
>  static int __init i2c_sch_init(void)
>  {
> -	return pci_register_driver(&sch_driver);
> +	return platform_driver_register(&smbus_sch_driver);
>  }
> 
>  static void __exit i2c_sch_exit(void)
>  {
> -	pci_unregister_driver(&sch_driver);
> +	platform_driver_unregister(&smbus_sch_driver);
>  }
> 
>  MODULE_AUTHOR("Jacob Pan <jacob.jun.pan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>");
> @@ -337,3 +322,4 @@ MODULE_LICENSE("GPL");
> 
>  module_init(i2c_sch_init);
>  module_exit(i2c_sch_exit);
> +MODULE_ALIAS("platform:isch_smbus");
> -- 
> 1.6.3.3

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

  reply	other threads:[~2010-03-02 10:05 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 10:24 [PATCH 0/3] Add Intel SCH GPIO driver Denis Turischev
2010-02-11 10:26 ` [PATCH 1/3] MFD: introduce lpc_sch for Intel SCH LPC bridge Denis Turischev
2010-02-11 10:26   ` Denis Turischev
2010-02-16 10:08   ` Samuel Ortiz
2010-02-16 10:08     ` Samuel Ortiz
2010-02-16 13:59     ` Pan, Jacob jun
2010-02-16 13:59       ` Pan, Jacob jun
2010-02-16 15:45       ` Jean Delvare
2010-02-16 17:19         ` Pan, Jacob jun
2010-02-16 17:19           ` Pan, Jacob jun
2010-02-16 17:29           ` Jean Delvare
2010-02-16 17:29             ` Jean Delvare
2010-02-16 19:57   ` David Brownell
2010-02-16 19:57     ` David Brownell
2010-02-16 21:49     ` Jean Delvare
2010-02-16 21:49       ` Jean Delvare
2010-02-17 10:03       ` Denis Turischev
2010-02-17 10:03         ` Denis Turischev
2010-02-17 10:44         ` Jean Delvare
2010-02-17 10:44           ` Jean Delvare
2010-02-17 12:35           ` Mike Rapoport
2010-02-17 12:35             ` Mike Rapoport
2010-02-17 14:37             ` Samuel Ortiz
2010-02-17 14:37               ` Samuel Ortiz
2010-02-18 17:42   ` [PATCH v2 " Denis Turischev
2010-02-18 17:42     ` Denis Turischev
2010-02-18 17:45     ` Randy Dunlap
2010-02-18 17:45       ` Randy Dunlap
2010-02-18 18:01       ` [PATCH v3 " Denis Turischev
2010-02-18 18:01         ` Denis Turischev
2010-02-18 18:08         ` Randy Dunlap
2010-02-18 18:08           ` Randy Dunlap
2010-02-19 10:30         ` Samuel Ortiz
2010-02-19 10:30           ` Samuel Ortiz
2010-02-23  8:26         ` Jean Delvare
2010-02-23  8:26           ` Jean Delvare
2010-02-23  9:25           ` Denis Turischev
2010-02-23  9:25             ` Denis Turischev
2010-02-23  9:41             ` Samuel Ortiz
2010-02-23  9:41               ` Samuel Ortiz
2010-02-11 10:28 ` [PATCH 2/3] i2c: convert i2c-isch to platform_device Denis Turischev
2010-02-11 10:28   ` Denis Turischev
2010-02-17 15:42   ` [PATCH v2 " Denis Turischev
2010-02-19 10:33     ` Samuel Ortiz
2010-02-19 10:33       ` Samuel Ortiz
2010-02-21 12:46     ` [PATCH v3 " Denis Turischev
2010-02-21 12:46       ` Denis Turischev
2010-02-23  7:00       ` Mike Rapoport
2010-02-23  7:00         ` Mike Rapoport
2010-02-23  8:12         ` Jean Delvare
2010-02-23  8:12           ` Jean Delvare
2010-02-23  8:20           ` Samuel Ortiz
2010-02-23  8:20             ` Samuel Ortiz
2010-02-23  8:24             ` Jean Delvare
2010-02-23  8:24               ` Jean Delvare
2010-02-28 19:00       ` Samuel Ortiz
2010-03-01 16:59         ` [PATCH v4 " Denis Turischev
2010-03-01 16:59           ` Denis Turischev
2010-03-02 10:06           ` Samuel Ortiz [this message]
2010-03-02 10:06             ` Samuel Ortiz
2010-02-11 10:28 ` [PATCH 3/3] gpio: add Intel SCH GPIO controller driver Denis Turischev
2010-02-11 10:28   ` Denis Turischev
2010-02-17 15:39   ` [PATCH v2 " Denis Turischev
2010-02-21 12:50     ` [PATCH v3 " Denis Turischev
2010-02-21 19:12       ` David Brownell
2010-02-24  6:49         ` Mike Rapoport
2010-03-01 18:09           ` Len Brown
2010-03-01 19:50             ` Alan Cox
2010-03-02  6:42             ` Mike Rapoport
2010-03-02  9:29               ` Denis Turischev
2010-02-28 19:01       ` Samuel Ortiz
2010-03-01 17:02         ` [PATCH v4 " Denis Turischev
2010-03-02 10:09           ` Samuel Ortiz

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=20100302100643.GA3195@sortiz.org \
    --to=sameo@linux.intel.com \
    --cc=denis@compulab.co.il \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@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.