From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: Aubin Constans <aubin.constans@microchip.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>
Subject: [PATCH v1 3/5] mmc: atmel-mci: Replace platform device pointer by generic one
Date: Wed, 17 Apr 2024 19:55:15 +0300 [thread overview]
Message-ID: <20240417165708.2965612-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240417165708.2965612-1-andriy.shevchenko@linux.intel.com>
There no need to keep a pointer to a platform device as it's not
used outside of ->probe() and ->remove() callbacks.
Replace platform device pointer by generic one in host structure.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mmc/host/atmel-mci.c | 44 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index c4dfd4c7785f..3aed57c392fa 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -296,7 +296,7 @@ struct atmel_mci_dma {
* rate and timeout calculations.
* @mapbase: Physical address of the MMIO registers.
* @mck: The peripheral bus clock hooked up to the MMC controller.
- * @pdev: Platform device associated with the MMC controller.
+ * @dev: Device associated with the MMC controller.
* @slot: Slots sharing this MMC controller.
* @caps: MCI capabilities depending on MCI version.
* @prepare_data: function to setup MCI before data transfer which
@@ -373,7 +373,7 @@ struct atmel_mci {
unsigned long bus_hz;
unsigned long mapbase;
struct clk *mck;
- struct platform_device *pdev;
+ struct device *dev;
struct atmel_mci_slot *slot[ATMCI_MAX_NR_SLOTS];
@@ -526,7 +526,7 @@ static void atmci_show_status_reg(struct seq_file *s,
static int atmci_regs_show(struct seq_file *s, void *v)
{
struct atmel_mci *host = s->private;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
u32 *buf;
int ret = 0;
@@ -726,7 +726,7 @@ static inline unsigned int atmci_convert_chksize(struct atmel_mci *host,
static void atmci_timeout_timer(struct timer_list *t)
{
struct atmel_mci *host = from_timer(host, t, timer);
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
dev_dbg(dev, "software timeout\n");
@@ -846,7 +846,7 @@ static u32 atmci_prepare_command(struct mmc_host *mmc,
static void atmci_send_command(struct atmel_mci *host,
struct mmc_command *cmd, u32 cmd_flags)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
unsigned int timeout_ms = cmd->busy_timeout ? cmd->busy_timeout :
ATMCI_CMD_TIMEOUT_MS;
@@ -863,7 +863,7 @@ static void atmci_send_command(struct atmel_mci *host,
static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
dev_dbg(dev, "send stop command\n");
atmci_send_command(host, data->stop, host->stop_cmdr);
@@ -937,8 +937,8 @@ static void atmci_pdc_set_both_buf(struct atmel_mci *host, int dir)
*/
static void atmci_pdc_cleanup(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
struct mmc_data *data = host->data;
+ struct device *dev = host->dev;
if (data)
dma_unmap_sg(dev, data->sg, data->sg_len, mmc_get_dma_dir(data));
@@ -951,7 +951,7 @@ static void atmci_pdc_cleanup(struct atmel_mci *host)
*/
static void atmci_pdc_complete(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
int transfer_size = host->data->blocks * host->data->blksz;
int i;
@@ -989,8 +989,8 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
static void atmci_dma_complete(void *arg)
{
struct atmel_mci *host = arg;
- struct device *dev = &host->pdev->dev;
struct mmc_data *data = host->data;
+ struct device *dev = host->dev;
dev_vdbg(dev, "DMA complete\n");
@@ -1079,7 +1079,7 @@ static u32 atmci_prepare_data(struct atmel_mci *host, struct mmc_data *data)
static u32
atmci_prepare_data_pdc(struct atmel_mci *host, struct mmc_data *data)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
u32 iflags, tmp;
int i;
@@ -1231,7 +1231,7 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data)
static void atmci_stop_transfer(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
dev_dbg(dev, "(%s) set pending xfer complete\n", __func__);
atmci_set_pending(host, EVENT_XFER_COMPLETE);
@@ -1249,7 +1249,7 @@ static void atmci_stop_transfer_pdc(struct atmel_mci *host)
static void atmci_stop_transfer_dma(struct atmel_mci *host)
{
struct dma_chan *chan = host->data_chan;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
if (chan) {
dmaengine_terminate_all(chan);
@@ -1269,7 +1269,7 @@ static void atmci_stop_transfer_dma(struct atmel_mci *host)
static void atmci_start_request(struct atmel_mci *host,
struct atmel_mci_slot *slot)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
struct mmc_request *mrq;
struct mmc_command *cmd;
struct mmc_data *data;
@@ -1364,7 +1364,7 @@ static void atmci_start_request(struct atmel_mci *host,
static void atmci_queue_request(struct atmel_mci *host,
struct atmel_mci_slot *slot, struct mmc_request *mrq)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
dev_vdbg(&slot->mmc->class_dev, "queue request: state=%d\n",
host->state);
@@ -1385,7 +1385,7 @@ static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct atmel_mci_slot *slot = mmc_priv(mmc);
struct atmel_mci *host = slot->host;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
struct mmc_data *data;
WARN_ON(slot->mrq);
@@ -1599,7 +1599,7 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
{
struct atmel_mci_slot *slot = NULL;
struct mmc_host *prev_mmc = host->cur_slot->mmc;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
WARN_ON(host->cmd || host->data);
@@ -1760,9 +1760,9 @@ static void atmci_detect_change(struct timer_list *t)
static void atmci_tasklet_func(struct tasklet_struct *t)
{
struct atmel_mci *host = from_tasklet(host, t, tasklet);
- struct device *dev = &host->pdev->dev;
struct mmc_request *mrq = host->mrq;
struct mmc_data *data = host->data;
+ struct device *dev = host->dev;
enum atmel_mci_state state = host->state;
enum atmel_mci_state prev_state;
u32 status;
@@ -2108,7 +2108,7 @@ static void atmci_sdio_interrupt(struct atmel_mci *host, u32 status)
static irqreturn_t atmci_interrupt(int irq, void *dev_id)
{
struct atmel_mci *host = dev_id;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
u32 status, mask, pending;
unsigned int pass_count = 0;
@@ -2253,7 +2253,7 @@ static int atmci_init_slot(struct atmel_mci *host,
struct mci_slot_pdata *slot_data, unsigned int id,
u32 sdc_reg, u32 sdio_irq)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
struct mmc_host *mmc;
struct atmel_mci_slot *slot;
int ret;
@@ -2377,7 +2377,7 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
static int atmci_configure_dma(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
host->dma.chan = dma_request_chan(dev, "rxtx");
if (IS_ERR(host->dma.chan))
@@ -2403,7 +2403,7 @@ static int atmci_configure_dma(struct atmel_mci *host)
*/
static void atmci_get_cap(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
unsigned int version;
version = atmci_get_version(host);
@@ -2481,7 +2481,7 @@ static int atmci_probe(struct platform_device *pdev)
if (!host)
return -ENOMEM;
- host->pdev = pdev;
+ host->dev = dev;
spin_lock_init(&host->lock);
INIT_LIST_HEAD(&host->queue);
--
2.43.0.rc1.1336.g36b5255a03ac
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: Aubin Constans <aubin.constans@microchip.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>
Subject: [PATCH v1 3/5] mmc: atmel-mci: Replace platform device pointer by generic one
Date: Wed, 17 Apr 2024 19:55:15 +0300 [thread overview]
Message-ID: <20240417165708.2965612-4-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240417165708.2965612-1-andriy.shevchenko@linux.intel.com>
There no need to keep a pointer to a platform device as it's not
used outside of ->probe() and ->remove() callbacks.
Replace platform device pointer by generic one in host structure.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mmc/host/atmel-mci.c | 44 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index c4dfd4c7785f..3aed57c392fa 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -296,7 +296,7 @@ struct atmel_mci_dma {
* rate and timeout calculations.
* @mapbase: Physical address of the MMIO registers.
* @mck: The peripheral bus clock hooked up to the MMC controller.
- * @pdev: Platform device associated with the MMC controller.
+ * @dev: Device associated with the MMC controller.
* @slot: Slots sharing this MMC controller.
* @caps: MCI capabilities depending on MCI version.
* @prepare_data: function to setup MCI before data transfer which
@@ -373,7 +373,7 @@ struct atmel_mci {
unsigned long bus_hz;
unsigned long mapbase;
struct clk *mck;
- struct platform_device *pdev;
+ struct device *dev;
struct atmel_mci_slot *slot[ATMCI_MAX_NR_SLOTS];
@@ -526,7 +526,7 @@ static void atmci_show_status_reg(struct seq_file *s,
static int atmci_regs_show(struct seq_file *s, void *v)
{
struct atmel_mci *host = s->private;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
u32 *buf;
int ret = 0;
@@ -726,7 +726,7 @@ static inline unsigned int atmci_convert_chksize(struct atmel_mci *host,
static void atmci_timeout_timer(struct timer_list *t)
{
struct atmel_mci *host = from_timer(host, t, timer);
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
dev_dbg(dev, "software timeout\n");
@@ -846,7 +846,7 @@ static u32 atmci_prepare_command(struct mmc_host *mmc,
static void atmci_send_command(struct atmel_mci *host,
struct mmc_command *cmd, u32 cmd_flags)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
unsigned int timeout_ms = cmd->busy_timeout ? cmd->busy_timeout :
ATMCI_CMD_TIMEOUT_MS;
@@ -863,7 +863,7 @@ static void atmci_send_command(struct atmel_mci *host,
static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
dev_dbg(dev, "send stop command\n");
atmci_send_command(host, data->stop, host->stop_cmdr);
@@ -937,8 +937,8 @@ static void atmci_pdc_set_both_buf(struct atmel_mci *host, int dir)
*/
static void atmci_pdc_cleanup(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
struct mmc_data *data = host->data;
+ struct device *dev = host->dev;
if (data)
dma_unmap_sg(dev, data->sg, data->sg_len, mmc_get_dma_dir(data));
@@ -951,7 +951,7 @@ static void atmci_pdc_cleanup(struct atmel_mci *host)
*/
static void atmci_pdc_complete(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
int transfer_size = host->data->blocks * host->data->blksz;
int i;
@@ -989,8 +989,8 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
static void atmci_dma_complete(void *arg)
{
struct atmel_mci *host = arg;
- struct device *dev = &host->pdev->dev;
struct mmc_data *data = host->data;
+ struct device *dev = host->dev;
dev_vdbg(dev, "DMA complete\n");
@@ -1079,7 +1079,7 @@ static u32 atmci_prepare_data(struct atmel_mci *host, struct mmc_data *data)
static u32
atmci_prepare_data_pdc(struct atmel_mci *host, struct mmc_data *data)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
u32 iflags, tmp;
int i;
@@ -1231,7 +1231,7 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data)
static void atmci_stop_transfer(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
dev_dbg(dev, "(%s) set pending xfer complete\n", __func__);
atmci_set_pending(host, EVENT_XFER_COMPLETE);
@@ -1249,7 +1249,7 @@ static void atmci_stop_transfer_pdc(struct atmel_mci *host)
static void atmci_stop_transfer_dma(struct atmel_mci *host)
{
struct dma_chan *chan = host->data_chan;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
if (chan) {
dmaengine_terminate_all(chan);
@@ -1269,7 +1269,7 @@ static void atmci_stop_transfer_dma(struct atmel_mci *host)
static void atmci_start_request(struct atmel_mci *host,
struct atmel_mci_slot *slot)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
struct mmc_request *mrq;
struct mmc_command *cmd;
struct mmc_data *data;
@@ -1364,7 +1364,7 @@ static void atmci_start_request(struct atmel_mci *host,
static void atmci_queue_request(struct atmel_mci *host,
struct atmel_mci_slot *slot, struct mmc_request *mrq)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
dev_vdbg(&slot->mmc->class_dev, "queue request: state=%d\n",
host->state);
@@ -1385,7 +1385,7 @@ static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
struct atmel_mci_slot *slot = mmc_priv(mmc);
struct atmel_mci *host = slot->host;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
struct mmc_data *data;
WARN_ON(slot->mrq);
@@ -1599,7 +1599,7 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
{
struct atmel_mci_slot *slot = NULL;
struct mmc_host *prev_mmc = host->cur_slot->mmc;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
WARN_ON(host->cmd || host->data);
@@ -1760,9 +1760,9 @@ static void atmci_detect_change(struct timer_list *t)
static void atmci_tasklet_func(struct tasklet_struct *t)
{
struct atmel_mci *host = from_tasklet(host, t, tasklet);
- struct device *dev = &host->pdev->dev;
struct mmc_request *mrq = host->mrq;
struct mmc_data *data = host->data;
+ struct device *dev = host->dev;
enum atmel_mci_state state = host->state;
enum atmel_mci_state prev_state;
u32 status;
@@ -2108,7 +2108,7 @@ static void atmci_sdio_interrupt(struct atmel_mci *host, u32 status)
static irqreturn_t atmci_interrupt(int irq, void *dev_id)
{
struct atmel_mci *host = dev_id;
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
u32 status, mask, pending;
unsigned int pass_count = 0;
@@ -2253,7 +2253,7 @@ static int atmci_init_slot(struct atmel_mci *host,
struct mci_slot_pdata *slot_data, unsigned int id,
u32 sdc_reg, u32 sdio_irq)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
struct mmc_host *mmc;
struct atmel_mci_slot *slot;
int ret;
@@ -2377,7 +2377,7 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
static int atmci_configure_dma(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
host->dma.chan = dma_request_chan(dev, "rxtx");
if (IS_ERR(host->dma.chan))
@@ -2403,7 +2403,7 @@ static int atmci_configure_dma(struct atmel_mci *host)
*/
static void atmci_get_cap(struct atmel_mci *host)
{
- struct device *dev = &host->pdev->dev;
+ struct device *dev = host->dev;
unsigned int version;
version = atmci_get_version(host);
@@ -2481,7 +2481,7 @@ static int atmci_probe(struct platform_device *pdev)
if (!host)
return -ENOMEM;
- host->pdev = pdev;
+ host->dev = dev;
spin_lock_init(&host->lock);
INIT_LIST_HEAD(&host->queue);
--
2.43.0.rc1.1336.g36b5255a03ac
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-17 16:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 16:55 [PATCH v1 0/5] mmc: atmel-mci: Get rid of leftovers and clean up Andy Shevchenko
2024-04-17 16:55 ` Andy Shevchenko
2024-04-17 16:55 ` [PATCH v1 1/5] mmc: atmel-mci: Get rid of platform data leftovers Andy Shevchenko
2024-04-17 16:55 ` Andy Shevchenko
2024-04-17 16:55 ` [PATCH v1 2/5] mmc: atmel-mci: Use temporary variable for struct device Andy Shevchenko
2024-04-17 16:55 ` Andy Shevchenko
2024-04-17 16:55 ` Andy Shevchenko [this message]
2024-04-17 16:55 ` [PATCH v1 3/5] mmc: atmel-mci: Replace platform device pointer by generic one Andy Shevchenko
2024-04-17 16:55 ` [PATCH v1 4/5] mmc: atmel-mci: Incapsulate used to be a platform data into host structure Andy Shevchenko
2024-04-17 16:55 ` Andy Shevchenko
2024-04-17 20:42 ` kernel test robot
2024-04-17 20:42 ` kernel test robot
2024-04-18 9:33 ` Andy Shevchenko
2024-04-18 9:33 ` Andy Shevchenko
2024-04-17 16:55 ` [PATCH v1 5/5] mmc: atmel-mci: Switch to use dev_err_probe() Andy Shevchenko
2024-04-17 16:55 ` Andy Shevchenko
2024-04-25 16:22 ` [PATCH v1 0/5] mmc: atmel-mci: Get rid of leftovers and clean up Ulf Hansson
2024-04-25 16:22 ` Ulf Hansson
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=20240417165708.2965612-4-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=alexandre.belloni@bootlin.com \
--cc=aubin.constans@microchip.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=ulf.hansson@linaro.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.